APIs: A Better Alternative    to Page Objects             Eileen Xie     Head of Quality at PBworks           #sfse 8/23/11
Page Objects
What are they trying to        solve?
What are they trying to        solve?• repetition• maintenance• readability
How well do they solve       them?
How well do they solve       them?• repetition: poorly• maintenance: poorly• readability: poorly
Repetition
Repetition• still too many steps• some steps repeated over and over  homePage = HomePage.load();  loginPage = homePage.get...
Maintenance
Maintenance• huge overhead• QA needs to maintain and fix• still dependent on page workflow• still dependent on page structur...
Readability
Readability• see repetition
What can we do   instead?
What can we do        instead?• APIs!
APIs
What do they look like?
What do they look like? createNetwork(); createNetworkWorkspace(); addNetworkUser();
What do they look like  under the hood?
What do they look like  under the hood?function createNetworkFolder(name) {    curl(“http://pbworks.com/api_v2/op/    Crea...
What?• Where’s all the code?• Why would we do this?• How do the API calls get tested?• How do we start?• Wait a minute...
Where’s all the code?
Where’s all the code?• in the product!• really.
Why would we do this?
Why would we do this?• less repetition• makes tests clearer• maintained by developers• easier to read• makes software more...
How do the API calls   get tested?
How do the API calls    get tested?• separate tests!• one test does the API stuff through the UI  dashboardPage.getNewTask...
How do we start?
How do we start?• figure out what the functions are• talk to your devs!• start with new functionality• greenfield projects
Wait a minute...
Wait a minute...• requires a ton of cooperation from devs• huge upfront cost• doesn’t actually replace page objects
Summary• APIs are awesome• ...and a pain in the ass to start using• complimentary to page objects
More Info• Our API: http://secure.pbworks.com/api_v2/• Me: eileen.xie@pbworks.com
Upcoming SlideShare
Loading in …5
×

APIs: A Better Alternative to Page Objects

1,825
-1

Published on

Eileen Xie, Head of #sfse lightning takls

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,825
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
20
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

APIs: A Better Alternative to Page Objects

  1. 1. APIs: A Better Alternative to Page Objects Eileen Xie Head of Quality at PBworks #sfse 8/23/11
  2. 2. Page Objects
  3. 3. What are they trying to solve?
  4. 4. What are they trying to solve?• repetition• maintenance• readability
  5. 5. How well do they solve them?
  6. 6. How well do they solve them?• repetition: poorly• maintenance: poorly• readability: poorly
  7. 7. Repetition
  8. 8. Repetition• still too many steps• some steps repeated over and over homePage = HomePage.load(); loginPage = homePage.getLoginLink().click(); welcomePage = loginPage.login(); newTaskPage = welcomePage.getNewTaskLink().click(); newTaskPage.getTaskNameField().type(“Learn Selenium”);
  9. 9. Maintenance
  10. 10. Maintenance• huge overhead• QA needs to maintain and fix• still dependent on page workflow• still dependent on page structure/layout
  11. 11. Readability
  12. 12. Readability• see repetition
  13. 13. What can we do instead?
  14. 14. What can we do instead?• APIs!
  15. 15. APIs
  16. 16. What do they look like?
  17. 17. What do they look like? createNetwork(); createNetworkWorkspace(); addNetworkUser();
  18. 18. What do they look like under the hood?
  19. 19. What do they look like under the hood?function createNetworkFolder(name) { curl(“http://pbworks.com/api_v2/op/ CreateNetworkFolder/name/” + name);}
  20. 20. What?• Where’s all the code?• Why would we do this?• How do the API calls get tested?• How do we start?• Wait a minute...
  21. 21. Where’s all the code?
  22. 22. Where’s all the code?• in the product!• really.
  23. 23. Why would we do this?
  24. 24. Why would we do this?• less repetition• makes tests clearer• maintained by developers• easier to read• makes software more testable• test execution speed• better than straight SQL insertions
  25. 25. How do the API calls get tested?
  26. 26. How do the API calls get tested?• separate tests!• one test does the API stuff through the UI dashboardPage.getNewTaskLink().click(); newTaskPage.getTaskNameField().type(“Learn Selenium”); newTaskPage.getTaskDueDateField().type(“8/31/11”);• every other test calls the API createTask();
  27. 27. How do we start?
  28. 28. How do we start?• figure out what the functions are• talk to your devs!• start with new functionality• greenfield projects
  29. 29. Wait a minute...
  30. 30. Wait a minute...• requires a ton of cooperation from devs• huge upfront cost• doesn’t actually replace page objects
  31. 31. Summary• APIs are awesome• ...and a pain in the ass to start using• complimentary to page objects
  32. 32. More Info• Our API: http://secure.pbworks.com/api_v2/• Me: eileen.xie@pbworks.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×