Objectify the Screenplay: A Story of Patterns

Objectify the Screenplay: A Story of Patterns

QA: Challenge Accepted 3.0 presentation

E3076b26dd2cd384939694fa5a00948e?s=128

apetkova

March 18, 2017
Tweet

Transcript

  1. A STORY OF PATTERNS

  2. About Me Aneta Petkova Automation QA Lead, Honeywell Aerospace aneta.petkova@honeywell.com

    linkedin.com/in/apetkova/
  3. Overview Journey #1: Back in time ••The PageObject pattern Journey

    #2: Into the now ••The Screenplay pattern Journey #3: Looking at tomorrow ••No spoilers yet
  4. Why should we care about patterns?

  5. The PageObject

  6. PageObject: concept Web Page Page class Test Separation: Keeping things

    tidy
  7. PageObject: structure WebDriver config

  8. PageObject: structure WebDriver config Page Object classes

  9. PageObject: structure WebDriver config Page Object classes Test classes

  10. PageObject Web Java private WebElement folderNameLabel; private WebElement downloadAllLink; private

    List<WebElement> files; public void sortByName(); public void downloadAll();
  11. PageObject The test method @Test public void sortTest() { BrowseFolderPage

    page = new BrowseFolderPage(); page.sortFilesByName(); List<String> actualFileNames = page.getFileNames(); List<String> expectedFileNames = new ArrayList<String>(actualFileNames); expectedFileNames.sort(); Assert.assertEquals(actualFileNames, expectedFileNames, "File names do not match"); }
  12. PageObject The test method @Test public void sortTest() { BrowseFolderPage

    page = new BrowseFolderPage(); page.sortFilesByName(); List<String> actualFileNames = page.getFileNames(); List<String> expectedFileNames = new ArrayList<String>(actualFileNames); expectedFileNames.sort(); Assert.assertEquals(actualFileNames, expectedFileNames, "File names do not match"); }
  13. PageObject The test method @Test public void sortTest() { BrowseFolderPage

    page = new BrowseFolderPage(); page.sortFilesByName(); List<String> actualFileNames = page.getFileNames(); List<String> expectedFileNames = new ArrayList<String>(actualFileNames); expectedFileNames.sort(); Assert.assertEquals(actualFileNames, expectedFileNames, "File names do not match"); }
  14. PageObject The test method @Test public void sortTest() { BrowseFolderPage

    page = new BrowseFolderPage(); page.sortFilesByName(); List<String> actualFileNames = page.getFileNames(); List<String> expectedFileNames = new ArrayList<String>(actualFileNames); expectedFileNames.sort(); Assert.assertEquals(actualFileNames, expectedFileNames, "File names do not match"); } baby_corgi.jpg cartoon_corgi.png snow_corgi.jpg
  15. PageObject The test method @Test public void sortTest() { BrowseFolderPage

    page = new BrowseFolderPage(); page.sortFilesByName(); List<String> actualFileNames = page.getFileNames(); List<String> expectedFileNames = new ArrayList<String>(actualFileNames); expectedFileNames.sort(); Assert.assertEquals(actualFileNames, expectedFileNames, "File names do not match"); }
  16. Payoff

  17. Payoff

  18. Payoff

  19. Pitfalls

  20. Pitfalls

  21. Pitfalls

  22. The PageObject

  23. The Screenplay pattern System functionality before system properties Actions before

    objects
  24. Screenplay: concept Actor

  25. Screenplay: concept Actor Abilities has

  26. Screenplay: concept Actor Abilities has Actions Tasks enable made up

    of performs
  27. Screenplay: concept Actor Abilities Actions Tasks has enable made up

    of performs Questions Elements Screen asks about the state of on the interact with
  28. Screenplay: library “Automated Acceptance Testing with Style” - and great

    reporting! /Thucydides.info
  29. Screenplay: structure Page Objects

  30. Screenplay: structure Tasks Page Objects

  31. Screenplay: structure State checks Tasks Page Objects

  32. Screenplay: structure Features -> tests State checks Tasks Page Objects

  33. Screenplay The PageObject class public static Target FOLDER_NAME = the(“Folder

    name label”).locatedBy(“#locator”); public static Target DOWNLOAD_ALL = the(“Download All link”).locatedBy(“#locator”); public static Target FILES = the(“List of files”).locatedBy(“#locator”);
  34. Screenplay The test method @Test public void should_be_able_to_sort_his_files_by_name() { roland.wasAbleTo(StartWith.aPopulatedFolder());

    roland.attemptsTo(SortFilesInFolder.by("Name")); roland.should(seeThat(FileList.displayed(), is(FileList.orderedBy(system)))); }
  35. Screenplay The test method @Test public void should_be_able_to_sort_his_files_by_name() { roland.wasAbleTo(StartWith.aPopulatedFolder())

    roland.attemptsTo(SortFilesInFolder.by("Name")); roland.should(seeThat(FileList.displayed(), is(FileList.orderedBy(system)))); }
  36. Screenplay The test method @Test public void should_be_able_to_sort_his_files_by_name() { roland.wasAbleTo(StartWith.aPopulatedFolder());

    roland.attemptsTo(SortFilesInFolder .by("Name")); roland.should(seeThat(FileList.displayed(), is(FileList.orderedBy(system)))); }
  37. Screenplay The test method @Test public void should_be_able_to_sort_his_files_by_name() { roland.wasAbleTo(StartWith.aPopulatedFolder());

    roland.attemptsTo(SortFilesInFolder.by("Name")); roland.should(seeThat(FileList.displayed(), is(FileList.orderedBy(system)))); }
  38. Serenity report

  39. Serenity report

  40. Payoff

  41. Payoff

  42. Payoff

  43. Payoff

  44. Pitfalls

  45. Pitfalls

  46. Pitfalls

  47. Pitfalls

  48. The middle ground

  49. The middle ground ØFocus on users, not asserts

  50. The middle ground ØFocus on users, not asserts ØKeep tasks

    in separate classes
  51. The middle ground ØFocus on users, not asserts ØKeep tasks

    in separate classes ØConsider relaxed encapsulation
  52. Define your own journey!

  53. aneta.petkova@honeywell.com linkedin.com/in/apetkova