apis: a better alternative to page objects
Post on 06-May-2015
1.465 Views
Preview:
DESCRIPTION
TRANSCRIPT
APIs: A Better Alternative to Page Objects
Eileen XieHead 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 overhomePage = HomePage.load();loginPage = homePage.getLoginLink().click();welcomePage = loginPage.login();newTaskPage = welcomePage.getNewTaskLink().click();newTaskPage.getTaskNameField().type(“Learn Selenium”);
Maintenance
Maintenance
• huge overhead
• QA needs to maintain and fix
• still dependent on page workflow
• still dependent on page structure/layout
Readability
Readability
• see repetition
What can we do instead?
What can we do instead?
• APIs!
APIs
What do they look like?
createNetwork();
createNetworkWorkspace();
addNetworkUser();
What do they look like?
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/CreateNetworkFolder/name/” + name);
}
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 testable
• test execution speed
• better than straight SQL insertions
How do the API calls get tested?
How do the API calls get tested?
• separate tests!
• one test does the API stuff through the UIdashboardPage.getNewTaskLink().click();newTaskPage.getTaskNameField().type(“Learn Selenium”);newTaskPage.getTaskDueDateField().type(“8/31/11”);
• every other test calls the APIcreateTask();
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
top related