browser controller testing for webapps (in windows environment)
TRANSCRIPT
1
Wurbe #5 Pag. 1/10
Tales from the dark side:browser controller testing
for webapps inWindows environment
Adrian Spineinetuality.ro
2
Wurbe #5 Pag. 2/10
Blackbox testingaka data testing, behavioral testing+ only tests functionality+ does not need server instrumentation+ easy to understand- sometimes performed by humans(and humans do not like it)- relatively hard to maintain- coverage of what ?
3
Wurbe #5 Pag. 3/10
Webapp testing before 2004-2005Mostly browser simulator(headless) patterneg. in Java:httpunithtmlunit...(inspired from junit/xunitcirca 1999 – Kent Beck,Erich Gamma)
4
Wurbe #5 Pag. 4/10
2005 – AJAX becomes de facto standard- Only HTML parsing is not good enough- Rhino ? No support for browser-specific objects- It's not easy to “rewrite” the browserSolution ?Browser controller – run a fullfledged browser instance anduse automation techniquesto control and check data
5
Wurbe #5 Pag. 5/10
Windows !+ massive user base+ IE still the dominant browser+ large variety of tools(commercial and open-source)+ OS automation APIs- mono-platform- makes you totally uncool- definitely will not improve your sex life
6
Wurbe #5 Pag. 6/10
Mainstream opensource & free toolsfor browser control/automationSamie (Perl)Pamie (Python)WatiR (Ruby)WatiN (.Net)AutoIT (Basic)...probably more(just Google it)
7
Wurbe #5 Pag. 7/10
But can you script any type of webapp ?Take Gmail, for instance – hard to blackbox(for sure it is instrumented for white box testing, debug,some REST equivalents, but that's not the point)●(relatively) unpredictable id values●very often, no names for elements●compose mail = a SPAN element, not a link●email body is written inside a ... BODY tag
8
Wurbe #5 Pag. 8/10
Yes you can.One of the solutions:●WatiNhttp://watin.sourceforge.net/●scripted with IronPythonhttp://www.codeplex.com/IronPython●spiced with WinForms.SendKeys... demo time !
9
Wurbe #5 Pag. 9/10
One more thing ...
10
Wurbe #5 Pag. 10/10
The Epiphany – testing is useless :)“Instead of wasting your time withtests, you'd better writebug-free code in the first place !”Customer, circa 2004(name withhold toprotect the innocents)