Understanding web applicationsto evaluate web testing tools- Narayan Raman
Web ApplicationHTTP RequestWeb ServerBrowserHTTPResponse(HTML, Javascript)
We test what is on the browserThe browser always gets HTML, javascriptWe don't need to worry about the server technology!Server or Browser?
Locating elementsDocument Object ModelXPathSimulating eventsFrom within the browserFrom outside the browserTest building blocks
HTML Pages -> represented in Javascript as a live window.documentobjectAnything can be accessed through DOMdocument.getElementsById("id")document.forms[2].elements["login"]document.images[23].srcdocument.links[5].hrefDOM: Document Object Model
XPaths are used to access structured XML data<person>  <name>Ram</name></person>//person[0]/nameXPaths
HTML is not data, it is presentation + data<div> <span class="labels">Name: </span> <span>Ram</span></div>/html/body/div/span[2]Semantic information now has to be ADDED to html idcssclass (more for presentation)Not the best solutionXPaths (contd)
Window1Frame1Frame2IFrame1XPath does not traverse Frames and Iframes.User has to identify the containing Frame or Iframe before using XpathXpath is not consistent across browsersXpath is slowMore problems:
DOM properties and methods are browser dependentNeed good wrapper functionsTo access DOM, need to go inside the browserBrowser pluginsProxy based approachBut, if accessible, DOM is more powerful than XPathDOM
Can monitor page load state and AJAX stateNo need for waitsCan create elegant functions in javascript to normalize browser differences//table[@id='listing']/tbody/tr[4]/td[4]/inputVs_textbox("q", _near(_cell("Python Cookbook")))DOM Advantages
OutsideWill be “real” simulation of events (OS level)May need browser in focusThe correct way, if easily possibleWrite drivers for every browser typeMaintenance problemBrowser quirksInsideProxy based approachEasy, but events are simulated at browser levelBrowser events allow parallel executionBrowser extensionsMaintenanceInside or Outside the browser?
Tests should run on any browserSteps should wait automatically for page load, AJAXElement identification should be stableRecord/identify elements automatically on any browserReduce playback time by running in parallelHandle complex UIs without the necessity to add idsBe simple to learn, scale and maintainWhat we should look for in Tools
Use a proxyInject smart javascriptCan handle any browserCan wait for page load/AJAXCan record on any browserSimulate events inside the browserAllows parallel playbackEasy to maintain – small code baseMinimal dependency on browser/OS architecturesSimplest possible approach
Object identification and event simulation are nearly solved problemsTests should reflect intent rather than implementation of UI.Login as “testuser” with password “secret”Vs_click(_button("Logout"));_setValue(_textbox("user"), "test");_setValue(_password("password"), "secret");_click(_submit("Login"));Going beyond
V Narayan Ramannarayan@tytosoftware.comhttp://sahi.co.in/Q&A

Understanding Web Applications and Web Testing Tools - QAConf

  • 1.
    Understanding web applicationstoevaluate web testing tools- Narayan Raman
  • 2.
    Web ApplicationHTTP RequestWebServerBrowserHTTPResponse(HTML, Javascript)
  • 3.
    We test whatis on the browserThe browser always gets HTML, javascriptWe don't need to worry about the server technology!Server or Browser?
  • 4.
    Locating elementsDocument ObjectModelXPathSimulating eventsFrom within the browserFrom outside the browserTest building blocks
  • 5.
    HTML Pages ->represented in Javascript as a live window.documentobjectAnything can be accessed through DOMdocument.getElementsById("id")document.forms[2].elements["login"]document.images[23].srcdocument.links[5].hrefDOM: Document Object Model
  • 6.
    XPaths are usedto access structured XML data<person> <name>Ram</name></person>//person[0]/nameXPaths
  • 7.
    HTML is notdata, it is presentation + data<div> <span class="labels">Name: </span> <span>Ram</span></div>/html/body/div/span[2]Semantic information now has to be ADDED to html idcssclass (more for presentation)Not the best solutionXPaths (contd)
  • 8.
    Window1Frame1Frame2IFrame1XPath does nottraverse Frames and Iframes.User has to identify the containing Frame or Iframe before using XpathXpath is not consistent across browsersXpath is slowMore problems:
  • 9.
    DOM properties andmethods are browser dependentNeed good wrapper functionsTo access DOM, need to go inside the browserBrowser pluginsProxy based approachBut, if accessible, DOM is more powerful than XPathDOM
  • 10.
    Can monitor pageload state and AJAX stateNo need for waitsCan create elegant functions in javascript to normalize browser differences//table[@id='listing']/tbody/tr[4]/td[4]/inputVs_textbox("q", _near(_cell("Python Cookbook")))DOM Advantages
  • 11.
    OutsideWill be “real”simulation of events (OS level)May need browser in focusThe correct way, if easily possibleWrite drivers for every browser typeMaintenance problemBrowser quirksInsideProxy based approachEasy, but events are simulated at browser levelBrowser events allow parallel executionBrowser extensionsMaintenanceInside or Outside the browser?
  • 12.
    Tests should runon any browserSteps should wait automatically for page load, AJAXElement identification should be stableRecord/identify elements automatically on any browserReduce playback time by running in parallelHandle complex UIs without the necessity to add idsBe simple to learn, scale and maintainWhat we should look for in Tools
  • 13.
    Use a proxyInjectsmart javascriptCan handle any browserCan wait for page load/AJAXCan record on any browserSimulate events inside the browserAllows parallel playbackEasy to maintain – small code baseMinimal dependency on browser/OS architecturesSimplest possible approach
  • 14.
    Object identification andevent simulation are nearly solved problemsTests should reflect intent rather than implementation of UI.Login as “testuser” with password “secret”Vs_click(_button("Logout"));_setValue(_textbox("user"), "test");_setValue(_password("password"), "secret");_click(_submit("Login"));Going beyond
  • 15.