Understanding web applications<br />to evaluate web testing tools<br />- Narayan Raman<br />
Web Application<br />HTTP Request<br />Web Server<br />Browser<br />HTTP<br />Response<br />(HTML, Javascript)<br />
We test what is on the browser<br />The browser always gets HTML, javascript<br />We don't need to worry about the server ...
Locating elements<br />Document Object Model<br />XPath<br />Simulating events<br />From within the browser<br />From outs...
HTML Pages -> represented in Javascript as a live window.documentobject<br />Anything can be accessed through DOM<br />doc...
XPaths are used to access structured XML data<br /><person><br />  <name>Ram</name><br /></person><br />//person[0]/name<b...
HTML is not data, it is presentation + data<br /><div><br /> <span class="labels">Name: </span><br /> <span>Ram</span><br ...
Window1<br />Frame1<br />Frame2<br />IFrame1<br />XPath does not traverse Frames and Iframes.<br />User has to identify th...
DOM properties and methods are browser dependent<br />Need good wrapper functions<br />To access DOM, need to go inside th...
Can monitor page load state and AJAX state<br />No need for waits<br />Can create elegant functions in javascript to norma...
Outside<br />Will be “real” simulation of events (OS level)<br />May need browser in focus<br />The correct way, if easily...
Tests should run on any browser<br />Steps should wait automatically for page load, AJAX<br />Element identification shoul...
Use a proxy<br />Inject smart javascript<br />Can handle any browser<br />Can wait for page load/AJAX<br />Can record on a...
Object identification and event simulation are nearly solved problems<br />Tests should reflect intent rather than impleme...
V Narayan Raman<br />narayan@tytosoftware.com<br />http://sahi.co.in/<br />Q&A<br />
Upcoming SlideShare
Loading in …5
×

Understanding Web Applications and Web Testing Tools - QAConf

1,143 views

Published on

This presentation talks about various approaches taken by web automation tools, and pros and cons of the approach.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,143
On SlideShare
0
From Embeds
0
Number of Embeds
37
Actions
Shares
0
Downloads
28
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Understanding Web Applications and Web Testing Tools - QAConf

  1. 1. Understanding web applications<br />to evaluate web testing tools<br />- Narayan Raman<br />
  2. 2. Web Application<br />HTTP Request<br />Web Server<br />Browser<br />HTTP<br />Response<br />(HTML, Javascript)<br />
  3. 3. We test what is on the browser<br />The browser always gets HTML, javascript<br />We don't need to worry about the server technology!<br />Server or Browser?<br />
  4. 4. Locating elements<br />Document Object Model<br />XPath<br />Simulating events<br />From within the browser<br />From outside the browser<br />Test building blocks<br />
  5. 5. HTML Pages -> represented in Javascript as a live window.documentobject<br />Anything can be accessed through DOM<br />document.getElementsById("id")<br />document.forms[2].elements["login"]<br />document.images[23].src<br />document.links[5].href<br />DOM: Document Object Model<br />
  6. 6. XPaths are used to access structured XML data<br /><person><br /> <name>Ram</name><br /></person><br />//person[0]/name<br />XPaths<br />
  7. 7. HTML is not data, it is presentation + data<br /><div><br /> <span class="labels">Name: </span><br /> <span>Ram</span><br /></div><br />/html/body/div/span[2]<br />Semantic information now has to be ADDED to html <br />id<br />cssclass (more for presentation)<br />Not the best solution<br />XPaths (contd)<br />
  8. 8. Window1<br />Frame1<br />Frame2<br />IFrame1<br />XPath does not traverse Frames and Iframes.<br />User has to identify the containing Frame or Iframe before using Xpath<br />Xpath is not consistent across browsers<br />Xpath is slow<br />More problems:<br />
  9. 9. DOM properties and methods are browser dependent<br />Need good wrapper functions<br />To access DOM, need to go inside the browser<br />Browser plugins<br />Proxy based approach<br />But, if accessible, DOM is more powerful than XPath<br />DOM<br />
  10. 10. Can monitor page load state and AJAX state<br />No need for waits<br />Can create elegant functions in javascript to normalize browser differences<br />//table[@id='listing']/tbody/tr[4]/td[4]/input<br />Vs<br />_textbox("q", _near(_cell("Python Cookbook")))<br />DOM Advantages<br />
  11. 11. Outside<br />Will be “real” simulation of events (OS level)<br />May need browser in focus<br />The correct way, if easily possible<br />Write drivers for every browser type<br />Maintenance problem<br />Browser quirks<br />Inside<br />Proxy based approach<br />Easy, but events are simulated at browser level<br />Browser events allow parallel execution<br />Browser extensions<br />Maintenance<br />Inside or Outside the browser?<br />
  12. 12. Tests should run on any browser<br />Steps should wait automatically for page load, AJAX<br />Element identification should be stable<br />Record/identify elements automatically on any browser<br />Reduce playback time by running in parallel<br />Handle complex UIs without the necessity to add ids<br />Be simple to learn, scale and maintain<br />What we should look for in Tools<br />
  13. 13. Use a proxy<br />Inject smart javascript<br />Can handle any browser<br />Can wait for page load/AJAX<br />Can record on any browser<br />Simulate events inside the browser<br />Allows parallel playback<br />Easy to maintain – small code base<br />Minimal dependency on browser/OS architectures<br />Simplest possible approach<br />
  14. 14. Object identification and event simulation are nearly solved problems<br />Tests should reflect intent rather than implementation of UI.<br />Login as “testuser” with password “secret”<br />Vs<br />_click(_button("Logout"));<br />_setValue(_textbox("user"), "test");<br />_setValue(_password("password"), "secret");<br />_click(_submit("Login"));<br />Going beyond<br />
  15. 15. V Narayan Raman<br />narayan@tytosoftware.com<br />http://sahi.co.in/<br />Q&A<br />

×