Introduction to-thucydides

38,690 views

Published on

Learn about Thucydides, an open source library designed to make it easier to write automated acceptance tests using Selenium 2.

Published in: Technology, Business
2 Comments
17 Likes
Statistics
Notes
No Downloads
Views
Total views
38,690
On SlideShare
0
From Embeds
0
Number of Embeds
3,205
Actions
Shares
0
Downloads
279
Comments
2
Likes
17
Embeds 0
No embeds

No notes for slide

Introduction to-thucydides

  1. 1. Introducing Thucydides Automated Acceptance Tests, Step by step John Ferguson SmartFriday, 9 March 12
  2. 2. So who is this guy, anyway? Consulta nt Trainer Mentor Author Speaker Coder John Fer guson S mar tFriday, 9 March 12
  3. 3. ATDDor Specification by exampleFriday, 9 March 12
  4. 4. ATDDor Specification by example The story of your appFriday, 9 March 12
  5. 5. Friday, 9 March 12
  6. 6. User stories As a job seeker I want to find jobs in relevant categories So that I can find a suitable jobFriday, 9 March 12
  7. 7. User stories As a job seeker I want to find jobs in relevant categories So that I can find a suitable job Features/EpicsFriday, 9 March 12
  8. 8. User stories As a job seeker I want to find jobs in relevant categories So that I can find a suitable job Acceptance criteria ☑  The  job  seeker  can  see  available  categories  on  the  home  page ☑  The  job  seeker  can  look  for  jobs  in  a  given  category ☑  The  job  seeker  can  see  what  category  a  job  belongs  toFriday, 9 March 12
  9. 9. User stories As a job seeker I want to find jobs in relevant categories So that I can find a suitable job Acceptance criteria ☑  The  job  seeker  can  see  available  categories  on  the  home  page ☑  The  job  seeker  can  look  for  jobs  in  a  given  category ☑  The  job  seeker  can  see  what  category  a  job  belongs  to scenario "A job seeker can see the available job categories on the home page", { when "the job seeker is looking for a job", then "the job seeker can see all the available job categories" } Automated acceptance testFriday, 9 March 12
  10. 10. scenario "A job seeker can see the available job categories on the home page", { when "the job seeker is looking for a job", then "the job seeker can see all the available job categories" } Automated acceptance testFriday, 9 March 12
  11. 11. scenario "A job seeker can see the available job categories on the home page", { when "the job seeker is looking for a job", then "the job seeker can see all the available job categories" } Automated acceptance test Implemented development testsFriday, 9 March 12
  12. 12. scenario "A job seeker can see the available job categories on the home page", { when "the job seeker is looking for a job", then "the job seeker can see all the available job categories" } Automated acceptance test Implemented development tests Implemented acceptance testsFriday, 9 March 12
  13. 13. Automated acceptance criteriaFriday, 9 March 12
  14. 14. Automated acceptance criteria Define your goalsFriday, 9 March 12
  15. 15. Automated acceptance criteriaFriday, 9 March 12
  16. 16. Automated acceptance criteria keep you on trackFriday, 9 March 12
  17. 17. Automated acceptance criteriaFriday, 9 March 12
  18. 18. Automated acceptance criteria Provide better visibilityFriday, 9 March 12
  19. 19. Automated acceptance criteriaFriday, 9 March 12
  20. 20. Automated acceptance criteria Allow faster release cyclesFriday, 9 March 12
  21. 21. Automated acceptance criteriaFriday, 9 March 12
  22. 22. Automated acceptance criteria Reduce RiskFriday, 9 March 12
  23. 23. Automated acceptance criteriaFriday, 9 March 12
  24. 24. Automated acceptance criteria Reduce CostsFriday, 9 March 12
  25. 25. Why should developers write web tests?Friday, 9 March 12
  26. 26. Why should developers write web tests? Shouldn’t QA be doing that?Friday, 9 March 12
  27. 27. Why only do QA at the end of the project?Friday, 9 March 12
  28. 28. Real quality cannot be injected at the endFriday, 9 March 12
  29. 29. Real quality cannot be injected at the end It must be part of the processFriday, 9 March 12
  30. 30. Leave the boring stuff to the automated tests...Friday, 9 March 12
  31. 31. ...and empower your QA teamFriday, 9 March 12
  32. 32. ...and empower your QA team Let testers focus on more intelligent testingFriday, 9 March 12
  33. 33. Acceptance Tests The high-level view So  where   are  we  at?Friday, 9 March 12
  34. 34. Low level web tests WebDriver   rocks! Focus on implementationFriday, 9 March 12
  35. 35. How do we bridge the gap?Friday, 9 March 12
  36. 36. How do we bridge the gap? Test stepsFriday, 9 March 12
  37. 37. scenario "A job seeker can see the available job categories on the home page", { when "the job seeker is looking for a job", then "the job seeker can see all the available job categories" } Automated Test stepsFriday, 9 March 12
  38. 38. scenario "A job seeker can see the available job categories on the home page", { when "the job seeker is looking for a job", then "the job seeker can see all the available job categories" } Automated scenario "The user can see the available job categories on the home page", { when "the job seeker is looking for a job", { job_seeker.open_jobs_page() } then "the job seeker can see all the available job categories", { job_seeker.should_see_job_categories "Java Developers", "Groovy Developers" } } Implemented Test stepsFriday, 9 March 12
  39. 39. scenario "A job seeker can see the available job categories on the home page", { when "the job seeker is looking for a job", then "the job seeker can see all the available job categories" } Automated scenario "The user can see the available job categories on the home page", { when "the job seeker is looking for a job", { job_seeker.open_jobs_page() } then "the job seeker can see all the available job categories", { job_seeker.should_see_job_categories "Java Developers", "Groovy Developers" } } Implemented JobSeekerSteps JobSeekerSteps JobSeekerSteps open_jobs_page() Test steps open_jobs_page() open_jobs_page() should_see_job_categories(String...  categories) should_see_job_categories(String...  categories) ... should_see_job_categories(String...  categories) ... ... Step librariesFriday, 9 March 12
  40. 40. scenario "The user can see the available job categories on the home page", { when "the job seeker is looking for a job", { job_seeker.open_jobs_page() } then "the job seeker can see all the available job categories", { job_seeker.should_see_job_categories "Java Developers", "Groovy Developers" } } Implemented Tests JobSeekerSteps JobSeekerSteps JobSeekerSteps open_jobs_page() open_jobs_page() open_jobs_page() should_see_job_categories(String...  categories) should_see_job_categories(String...  categories) ... should_see_job_categories(String...  categories) ... ... Step libraries Test stepsFriday, 9 March 12
  41. 41. scenario "The user can see the available job categories on the home page", { when "the job seeker is looking for a job", { job_seeker.open_jobs_page() } then "the job seeker can see all the available job categories", { job_seeker.should_see_job_categories "Java Developers", "Groovy Developers" } } Implemented Tests JobSeekerSteps JobSeekerSteps JobSeekerSteps open_jobs_page() open_jobs_page() open_jobs_page() should_see_job_categories(String...  categories) should_see_job_categories(String...  categories) ... should_see_job_categories(String...  categories) ... ... Step libraries Test steps Page ObjectsFriday, 9 March 12
  42. 42. Test stepsFriday, 9 March 12
  43. 43. Test stepsFriday, 9 March 12
  44. 44. Test stepsFriday, 9 March 12
  45. 45. Test stepsFriday, 9 March 12
  46. 46. Test stepsFriday, 9 March 12
  47. 47. Test steps help organize your testsFriday, 9 March 12
  48. 48. Test stepsFriday, 9 March 12
  49. 49. Test steps are a communication toolFriday, 9 March 12
  50. 50. Test stepsFriday, 9 March 12
  51. 51. Test steps are reusable building blocksFriday, 9 March 12
  52. 52. Test stepsFriday, 9 March 12
  53. 53. Test steps help estimate progressFriday, 9 March 12
  54. 54. And so we built a tool...Friday, 9 March 12
  55. 55. Friday, 9 March 12
  56. 56. Webdriver/Selenium 2 extensionFriday, 9 March 12
  57. 57. Webdriver/Selenium 2 extension Organize tests, stories and featuresFriday, 9 March 12
  58. 58. Webdriver/Selenium 2 extension Organize tests, stories and features Record/report test executionFriday, 9 March 12
  59. 59. Webdriver/Selenium 2 extension Organize tests, stories and features Record/report test execution Measure functional coverageFriday, 9 March 12
  60. 60. Friday, 9 March 12
  61. 61. Thucydides in actionFriday, 9 March 12
  62. 62. Thucydides in action A simple demo appFriday, 9 March 12
  63. 63. Defining your acceptance tests scenario "A job seeker { can see the available j ob categori when "the j es on the h ob seeker i ome page", then "the j s looking f ob seeker c o r a j o b ", } an see all the availab le job cate gories" scenario "The administrator adds a new category to the system", { given "a new category needs to be added to the system", when "the administrator adds a new category", then "the system should confirm that the category has been created", and "the new category should be visible to job seekers", } scenario "The admini strator deletes a ca { tegory from the syst em", given "a category ne eds to be deleted", when "the administra tor deletes a catego then "the system will ry", confirm that the cate and "the deleted cate gory has been delete gory should no longer d", } be visible to job se eker s",Friday, 9 March 12
  64. 64. Defining your acceptance tests scenario "A job seeker { can see the available j ob categori when "the j es on the h ob seeker i ome page", then "the j s looking f ob seeker c o r a j o b ", } an see all the availab le job cate gories" scenario "The administrator adds a new category to the system", { given "a new category needs to be added to the system", when "the administrator adds a new category", then "the system should confirm that the category has been created", and "the new category should be visible to job seekers", } scenario "The admini strator deletes a ca { tegory from the syst em", given "a category ne eds to be deleted", when "the administra tor deletes a catego then "the system will ry", confirm that the cate and "the deleted cate gory has been delete gory should no longer d", } be visible to job se eker s", focus on business valueFriday, 9 March 12
  65. 65. Defining your acceptance tests scenario "A job seeker { can see the available j ob categori when "the j es on the h ob seeker i ome page", then "the j s looking f ob seeker c o r a j o b ", } an see all the availab le job cate gories" scenario "The administrator adds a new category to the system", { given "a new category needs to be added to the system", when "the administrator adds a new category", then "the system should confirm that the category has been created", and "the new category should be visible to job seekers", } { scenario "The admini strator deletes a ca tegory from the syst em", ...defined in business terms given "a category ne eds to be deleted", when "the administra tor deletes a catego then "the system will ry", confirm that the cate and "the deleted cate gory has been delete gory should no longer d", } be visible to job se eker s", focus on business valueFriday, 9 March 12
  66. 66. Defining your acceptance tests scenario "A job seeker { can see the available j ob categori when "the j es on the h ob seeker i ome page", then "the j s looking f ob seeker c o r a j o b ", } an see all the availab le job cate gories" High level requ irements... scenario "The administrator adds a new category to the system", { given "a new category needs to be added to the system", when "the administrator adds a new category", then "the system should confirm that the category has been created", and "the new category should be visible to job seekers", } { scenario "The admini strator deletes a ca tegory from the syst em", ...defined in business terms given "a category ne eds to be deleted", when "the administra tor deletes a catego then "the system will ry", confirm that the cate and "the deleted cate gory has been delete gory should no longer d", } be visible to job se eker s", focus on business valueFriday, 9 March 12
  67. 67. Organizing your requirements public class Application { @Feature public class ManageCompanies { public class AddNewCompany {} public class DeleteCompany {} public class ListCompanies {} } @Feature public class ManageCategories { public class AddNewCategory {} public class ListCategories {} public class DeleteCategory {} } @Feature public class BrowseJobs { public class UserLookForJobs {} public class UserBrowsesJobTabs {} } }Friday, 9 March 12
  68. 68. Organizing your requirements Features public class Application { @Feature public class ManageCompanies { public class AddNewCompany {} public class DeleteCompany {} public class ListCompanies {} } @Feature public class ManageCategories { public class AddNewCategory {} public class ListCategories {} public class DeleteCategory {} } @Feature public class BrowseJobs { public class UserLookForJobs {} public class UserBrowsesJobTabs {} } }Friday, 9 March 12
  69. 69. Organizing your requirements Features public class Application { @Feature public class ManageCompanies { public class AddNewCompany {} public class DeleteCompany {} public class ListCompanies {} } @Feature public class ManageCategories { public class AddNewCategory {} public class ListCategories {} public class DeleteCategory {} } @Feature Stories public class BrowseJobs { public class UserLookForJobs {} public class UserBrowsesJobTabs {} } }Friday, 9 March 12
  70. 70. Organizing your requirements Features public class Application { @Feature public class ManageCompanies { public class AddNewCompany {} public class DeleteCompany {} public class ListCompanies {} } @Feature public class ManageCategories { public class AddNewCategory {} public class ListCategories {} public class DeleteCategory {} } @Feature Stories public class BrowseJobs { public class UserLookForJobs {} public class UserBrowsesJobTabs {} } }Friday, 9 March 12
  71. 71. Implementing your acceptance tests using "thucydides" thucydides.uses_steps_from AdministratorSteps thucydides.uses_steps_from JobSeekerSteps thucydides.tests_story AddNewCategory scenario "The administrator adds a new category to the system", { given "a new category needs to be added to the system", { administrator.logs_in_to_admin_page_if_first_time() administrator.opens_categories_list() } when "the administrator adds a new category", { administrator.selects_add_category() administrator.adds_new_category("Scala Developers","SCALA") } then "the system should confirm that the category has been created", { administrator.should_see_confirmation_message "The Category has been created" } and "the new category should be visible to job seekers", { job_seeker.opens_jobs_page() job_seeker.should_see_job_category "Scala Developers" } }Friday, 9 March 12
  72. 72. Implementing your acceptance tests using "thucydides" We are testing this story thucydides.uses_steps_from AdministratorSteps thucydides.uses_steps_from JobSeekerSteps thucydides.tests_story AddNewCategory scenario "The administrator adds a new category to the system", { given "a new category needs to be added to the system", { administrator.logs_in_to_admin_page_if_first_time() administrator.opens_categories_list() } when "the administrator adds a new category", { administrator.selects_add_category() administrator.adds_new_category("Scala Developers","SCALA") } then "the system should confirm that the category has been created", { administrator.should_see_confirmation_message "The Category has been created" } and "the new category should be visible to job seekers", { job_seeker.opens_jobs_page() job_seeker.should_see_job_category "Scala Developers" } }Friday, 9 March 12
  73. 73. Implementing your acceptance tests using "thucydides" We are testing this story thucydides.uses_steps_from AdministratorSteps thucydides.uses_steps_from JobSeekerSteps thucydides.tests_story AddNewCategory An acceptance criteria scenario "The administrator adds a new category to the system", { given "a new category needs to be added to the system", { administrator.logs_in_to_admin_page_if_first_time() administrator.opens_categories_list() } when "the administrator adds a new category", { administrator.selects_add_category() administrator.adds_new_category("Scala Developers","SCALA") } then "the system should confirm that the category has been created", { administrator.should_see_confirmation_message "The Category has been created" } and "the new category should be visible to job seekers", { job_seeker.opens_jobs_page() job_seeker.should_see_job_category "Scala Developers" } }Friday, 9 March 12
  74. 74. Implementing your acceptance tests using "thucydides" We are testing this story thucydides.uses_steps_from AdministratorSteps thucydides.uses_steps_from JobSeekerSteps thucydides.tests_story AddNewCategory An acceptance criteria scenario "The administrator adds a new category to the system", { given "a new category needs to be added to the system", { Narrative style administrator.logs_in_to_admin_page_if_first_time() administrator.opens_categories_list() } when "the administrator adds a new category", { administrator.selects_add_category() administrator.adds_new_category("Scala Developers","SCALA") } then "the system should confirm that the category has been created", { administrator.should_see_confirmation_message "The Category has been created" } and "the new category should be visible to job seekers", { job_seeker.opens_jobs_page() job_seeker.should_see_job_category "Scala Developers" } }Friday, 9 March 12
  75. 75. Implementing your acceptance tests using "thucydides" We are testing this story thucydides.uses_steps_from AdministratorSteps thucydides.uses_steps_from JobSeekerSteps thucydides.tests_story AddNewCategory An acceptance criteria scenario "The administrator adds a new category to the system", { given "a new category needs to be added to the system", { Narrative style administrator.logs_in_to_admin_page_if_first_time() administrator.opens_categories_list() } Step through an when "the administrator adds a new category", example { administrator.selects_add_category() administrator.adds_new_category("Scala Developers","SCALA") } then "the system should confirm that the category has been created", { administrator.should_see_confirmation_message "The Category has been created" } and "the new category should be visible to job seekers", { job_seeker.opens_jobs_page() job_seeker.should_see_job_category "Scala Developers" } }Friday, 9 March 12
  76. 76. Implementing your acceptance tests using "thucydides" We are testing this story thucydides.uses_steps_from AdministratorSteps thucydides.uses_steps_from JobSeekerSteps thucydides.tests_story AddNewCategory An acceptance criteria scenario "The administrator adds a new category to the system", { given "a new category needs to be added to the system", { Narrative style administrator.logs_in_to_admin_page_if_first_time() administrator.opens_categories_list() } Step through an when "the administrator adds a new category", example { administrator.selects_add_category() administrator.adds_new_category("Scala Developers","SCALA") } then "the system should confirm that the category has been created", { administrator.should_see_confirmation_message "The Category has been created" } and "the new category should be visible to job seekers", { Still high-level job_seeker.opens_jobs_page() job_seeker.should_see_job_category "Scala Developers" } }Friday, 9 March 12
  77. 77. Some folks prefer JUnit... @RunWith(ThucydidesRunner.class) @Story(AddNewCategory.class) public class AddCategoryStory { @Managed public WebDriver webdriver; @ManagedPages(defaultUrl = "http://localhost:9000") public Pages pages; @Steps public AdministratorSteps administrator; @Steps public JobSeekerSteps job_seeker; @Test public void administrator_adds_a_new_category_to_the_system() { administrator.logs_in_to_admin_page_if_first_time(); administrator.opens_categories_list(); administrator.selects_add_category(); administrator.adds_new_category("Java Developers","JAVA"); administrator.should_see_confirmation_message("The Category has been created"); job_seeker.opens_job_page(); job_seeker.should_see_job_category("Java Developers"); } @Pending @Test public void administrator_adds_an_existing_category_to_the_system() {} }Friday, 9 March 12
  78. 78. Some folks prefer JUnit... @RunWith(ThucydidesRunner.class) @Story(AddNewCategory.class) Thucydides handles the public class AddCategoryStory { web driver instances @Managed public WebDriver webdriver; @ManagedPages(defaultUrl = "http://localhost:9000") public Pages pages; @Steps public AdministratorSteps administrator; @Steps public JobSeekerSteps job_seeker; @Test public void administrator_adds_a_new_category_to_the_system() { administrator.logs_in_to_admin_page_if_first_time(); administrator.opens_categories_list(); administrator.selects_add_category(); administrator.adds_new_category("Java Developers","JAVA"); administrator.should_see_confirmation_message("The Category has been created"); job_seeker.opens_job_page(); job_seeker.should_see_job_category("Java Developers"); } @Pending @Test public void administrator_adds_an_existing_category_to_the_system() {} }Friday, 9 March 12
  79. 79. Some folks prefer JUnit... @RunWith(ThucydidesRunner.class) @Story(AddNewCategory.class) Thucydides handles the public class AddCategoryStory { web driver instances @Managed public WebDriver webdriver; @ManagedPages(defaultUrl = "http://localhost:9000") public Pages pages; @Steps public AdministratorSteps administrator; @Steps Using the same steps public JobSeekerSteps job_seeker; @Test public void administrator_adds_a_new_category_to_the_system() { administrator.logs_in_to_admin_page_if_first_time(); administrator.opens_categories_list(); administrator.selects_add_category(); administrator.adds_new_category("Java Developers","JAVA"); administrator.should_see_confirmation_message("The Category has been created"); job_seeker.opens_job_page(); job_seeker.should_see_job_category("Java Developers"); } @Pending @Test public void administrator_adds_an_existing_category_to_the_system() {} }Friday, 9 March 12
  80. 80. Some folks prefer JUnit... @RunWith(ThucydidesRunner.class) @Story(AddNewCategory.class) Thucydides handles the public class AddCategoryStory { web driver instances @Managed public WebDriver webdriver; @ManagedPages(defaultUrl = "http://localhost:9000") public Pages pages; @Steps public AdministratorSteps administrator; @Steps Using the same steps public JobSeekerSteps job_seeker; @Test public void administrator_adds_a_new_category_to_the_system() { administrator.logs_in_to_admin_page_if_first_time(); administrator.opens_categories_list(); administrator.selects_add_category(); administrator.adds_new_category("Java Developers","JAVA"); administrator.should_see_confirmation_message("The Category has been created"); job_seeker.opens_job_page(); job_seeker.should_see_job_category("Java Developers"); } Tests can be pending @Pending @Test public void administrator_adds_an_existing_category_to_the_system() {} }Friday, 9 March 12
  81. 81. Defining your test steps public class AdministratorSteps extends ScenarioSteps { @Step public void opens_categories_list() { AdminHomePage page = getPages().get(AdminHomePage.class); page.open(); page.selectObjectType("Categories"); } @Step public void selects_add_category() { CategoriesPage categoriesPage = getPages().get(CategoriesPage.class); categoriesPage.selectAddCategory(); } @Step public void adds_new_category(String label, String code) { EditCategoryPage newCategoryPage = getPages().get(EditCategoryPage.class); newCategoryPage.saveNewCategory(label, code); } @Step public void should_see_confirmation_message(String message) { AdminPage page = getPages().get(AdminPage.class); page.shouldContainConfirmationMessage(message); } @Step public void deletes_category(String name) { opens_categories_list(); displays_category_details_for(name); deletes_category(); } }Friday, 9 March 12
  82. 82. Defining your test steps public class AdministratorSteps extends ScenarioSteps { A step library @Step public void opens_categories_list() { AdminHomePage page = getPages().get(AdminHomePage.class); page.open(); page.selectObjectType("Categories"); } @Step public void selects_add_category() { CategoriesPage categoriesPage = getPages().get(CategoriesPage.class); categoriesPage.selectAddCategory(); } @Step public void adds_new_category(String label, String code) { EditCategoryPage newCategoryPage = getPages().get(EditCategoryPage.class); newCategoryPage.saveNewCategory(label, code); } @Step public void should_see_confirmation_message(String message) { AdminPage page = getPages().get(AdminPage.class); page.shouldContainConfirmationMessage(message); } @Step public void deletes_category(String name) { opens_categories_list(); displays_category_details_for(name); deletes_category(); } }Friday, 9 March 12
  83. 83. Defining your test steps public class AdministratorSteps extends ScenarioSteps { A step library @Step public void opens_categories_list() { AdminHomePage page = getPages().get(AdminHomePage.class); page.open(); page.selectObjectType("Categories"); } High level steps... @Step public void selects_add_category() { CategoriesPage categoriesPage = getPages().get(CategoriesPage.class); categoriesPage.selectAddCategory(); } @Step public void adds_new_category(String label, String code) { EditCategoryPage newCategoryPage = getPages().get(EditCategoryPage.class); newCategoryPage.saveNewCategory(label, code); } @Step public void should_see_confirmation_message(String message) { AdminPage page = getPages().get(AdminPage.class); page.shouldContainConfirmationMessage(message); } @Step public void deletes_category(String name) { opens_categories_list(); displays_category_details_for(name); deletes_category(); } }Friday, 9 March 12
  84. 84. Defining your test steps public class AdministratorSteps extends ScenarioSteps { A step library @Step public void opens_categories_list() { AdminHomePage page = getPages().get(AdminHomePage.class); page.open(); page.selectObjectType("Categories"); } High level steps... @Step public void selects_add_category() { CategoriesPage categoriesPage = getPages().get(CategoriesPage.class); categoriesPage.selectAddCategory(); } @Step public void adds_new_category(String label, String code) { EditCategoryPage newCategoryPage = getPages().get(EditCategoryPage.class); newCategoryPage.saveNewCategory(label, code); } ...implemented @Step public void should_see_confirmation_message(String message) { with Page Objects AdminPage page = getPages().get(AdminPage.class); page.shouldContainConfirmationMessage(message); } @Step public void deletes_category(String name) { opens_categories_list(); displays_category_details_for(name); deletes_category(); } }Friday, 9 March 12
  85. 85. Defining your test steps public class AdministratorSteps extends ScenarioSteps { A step library @Step public void opens_categories_list() { AdminHomePage page = getPages().get(AdminHomePage.class); page.open(); page.selectObjectType("Categories"); } High level steps... @Step public void selects_add_category() { CategoriesPage categoriesPage = getPages().get(CategoriesPage.class); categoriesPage.selectAddCategory(); } @Step public void adds_new_category(String label, String code) { EditCategoryPage newCategoryPage = getPages().get(EditCategoryPage.class); newCategoryPage.saveNewCategory(label, code); } ...implemented @Step public void should_see_confirmation_message(String message) { with Page Objects AdminPage page = getPages().get(AdminPage.class); page.shouldContainConfirmationMessage(message); } @Step ...or with other steps public void deletes_category(String name) { opens_categories_list(); displays_category_details_for(name); deletes_category(); } }Friday, 9 March 12
  86. 86. Defining your page objects public class EditCategoryPage extends PageObject { @FindBy(id="object_label") WebElement label; @FindBy(id="object_code") WebElement code; @FindBy(name="_save") WebElement saveButton; public EditCategoryPage(WebDriver driver) { super(driver); } public void saveNewCategory(String labelValue, String codeValue) { typeInto(label, labelValue); typeInto(code, codeValue); saveButton.click(); } }Friday, 9 March 12
  87. 87. Defining your page objects public class EditCategoryPage extends PageObject { @FindBy(id="object_label") WebElement label; Provides some useful @FindBy(id="object_code") utility methods... WebElement code; @FindBy(name="_save") WebElement saveButton; public EditCategoryPage(WebDriver driver) { super(driver); } public void saveNewCategory(String labelValue, String codeValue) { typeInto(label, labelValue); typeInto(code, codeValue); saveButton.click(); } }Friday, 9 March 12
  88. 88. Defining your page objects public class EditCategoryPage extends PageObject { @FindBy(id="object_label") WebElement label; Provides some useful @FindBy(id="object_code") utility methods... WebElement code; @FindBy(name="_save") WebElement saveButton; public EditCategoryPage(WebDriver driver) { super(driver); } public void saveNewCategory(String labelValue, String codeValue) { typeInto(label, labelValue); typeInto(code, codeValue); saveButton.click(); } } but otherwise a normal WebDriver Page ObjectFriday, 9 March 12
  89. 89. Then we run the tests...Friday, 9 March 12
  90. 90. Thucydides reportsFriday, 9 March 12
  91. 91. Thucydides reportsFriday, 9 March 12
  92. 92. Thucydides reports Browse the featuresFriday, 9 March 12
  93. 93. Browse the storiesFriday, 9 March 12
  94. 94. Browse the storiesFriday, 9 March 12
  95. 95. Browse the stories Browse the storiesFriday, 9 March 12
  96. 96. Browse the storiesFriday, 9 March 12
  97. 97. Browse the stories Browse the test scenariosFriday, 9 March 12
  98. 98. Browse the stories Browse the test scenariosFriday, 9 March 12
  99. 99. Illustrating the test paths A test scenario Steps Test scenariosFriday, 9 March 12
  100. 100. Friday, 9 March 12
  101. 101. Illustrating the test paths ScreenshotsFriday, 9 March 12
  102. 102. Functional coverage FeaturesFriday, 9 March 12
  103. 103. Functional coverage User storiesFriday, 9 March 12
  104. 104. Functional coverageFriday, 9 March 12
  105. 105. Functional coverage Passing testsFriday, 9 March 12
  106. 106. Functional coverage Passing tests Failing testsFriday, 9 March 12
  107. 107. Functional coverage Passing tests Pending tests Failing testsFriday, 9 March 12
  108. 108. Functional coverageFriday, 9 March 12
  109. 109. Functional coverage PlannedFriday, 9 March 12
  110. 110. Functional coverage Planned DoneFriday, 9 March 12
  111. 111. Functional coverage Planned Done BrokenFriday, 9 March 12
  112. 112. Functional coverage Test scenariosFriday, 9 March 12
  113. 113. Functional coverageFriday, 9 March 12
  114. 114. Thucydides in Action A simple real-world testFriday, 9 March 12
  115. 115. Thucydides in Action A simple real-world testFriday, 9 March 12
  116. 116. Thucydides in ActionFriday, 9 March 12
  117. 117. Thucydides in ActionFriday, 9 March 12
  118. 118. Thucydides in Action Groovy shortcuts to obtain a page objectFriday, 9 March 12
  119. 119. Thucydides in Action Groovy shortcuts to obtain a page objectFriday, 9 March 12
  120. 120. Thucydides in Action Groovy shortcuts to obtain a page object A simple page objectFriday, 9 March 12
  121. 121. Thucydides in ActionFriday, 9 March 12
  122. 122. Thucydides in ActionFriday, 9 March 12
  123. 123. Thucydides in ActionFriday, 9 March 12
  124. 124. Thucydides in Action DSL for HTML tablesFriday, 9 March 12
  125. 125. Thucydides in ActionFriday, 9 March 12
  126. 126. Thucydides in Action Store field values between test stepsFriday, 9 March 12
  127. 127. Thucydides in Action Store field values between test stepsFriday, 9 March 12
  128. 128. Thucydides in Action Store field values between test steps ...and use them laterFriday, 9 March 12
  129. 129. ReferencesFriday, 9 March 12
  130. 130. References github.com/thucydides-webtestsFriday, 9 March 12
  131. 131. References github.com/thucydides-webtests thucydides-webtests.comFriday, 9 March 12
  132. 132. References github.com/thucydides-webtests thucydides-webtests.com wakaleo.com/thucydidesFriday, 9 March 12
  133. 133. Introducing Thucydides Automated Acceptance Tests, Step by step John  Ferguson  Smart Email:  john.smart@wakaleo.com Web:  hEp://www.wakaleo.com TwiEer:  wakaleoFriday, 9 March 12

×