APIs: A Better Alternative to Page Objects

Like this? Share it with your network

Share

APIs: A Better Alternative to Page Objects

  • 1,911 views
Uploaded on

Eileen Xie, Head of #sfse lightning takls

Eileen Xie, Head of #sfse lightning takls

More in: Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,911
On Slideshare
1,911
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
18
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. APIs: A Better Alternative to Page Objects Eileen Xie Head of Quality at PBworks #sfse 8/23/11
  • 2. Page Objects
  • 3. What are they trying to solve?
  • 4. What are they trying to solve?• repetition• maintenance• readability
  • 5. How well do they solve them?
  • 6. How well do they solve them?• repetition: poorly• maintenance: poorly• readability: poorly
  • 7. Repetition
  • 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. Maintenance
  • 10. Maintenance• huge overhead• QA needs to maintain and fix• still dependent on page workflow• still dependent on page structure/layout
  • 11. Readability
  • 12. Readability• see repetition
  • 13. What can we do instead?
  • 14. What can we do instead?• APIs!
  • 15. APIs
  • 16. What do they look like?
  • 17. What do they look like? createNetwork(); createNetworkWorkspace(); addNetworkUser();
  • 18. What do they look like under the hood?
  • 19. What do they look like under the hood?function createNetworkFolder(name) { curl(“http://pbworks.com/api_v2/op/ CreateNetworkFolder/name/” + name);}
  • 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. Where’s all the code?
  • 22. Where’s all the code?• in the product!• really.
  • 23. Why would we do this?
  • 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. How do the API calls get tested?
  • 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. How do we start?
  • 28. How do we start?• figure out what the functions are• talk to your devs!• start with new functionality• greenfield projects
  • 29. Wait a minute...
  • 30. Wait a minute...• requires a ton of cooperation from devs• huge upfront cost• doesn’t actually replace page objects
  • 31. Summary• APIs are awesome• ...and a pain in the ass to start using• complimentary to page objects
  • 32. More Info• Our API: http://secure.pbworks.com/api_v2/• Me: eileen.xie@pbworks.com