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”);
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...
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
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();