Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Build Tests to Build Websites

33 views

Published on

Technologies like Squarespace, Salesforce, WordPress, or WIX are extremely popular for those who want to create a working website without necessary developer knowledge. In this talk, I would explore how Salesforce uses Page Object Model patterns to test its Communities platform which is used to develop websites for Salesforce users.

Throughout the talk, we will explore how multi-frame platform can be directly mapped to POM for Selenium Webdriver, and how client side code is developed to support this pattern.

The importance and complexity of these test framework is that it needs to be applicable for both platform and produced websites.
Recording: https://youtu.be/6opoooLdonI

Published in: Software
  • Be the first to comment

  • Be the first to like this

Build Tests to Build Websites

  1. 1. Build Tests to Build Websites Dmitry Vinnik Senior Software Engineer dvinnik@salesforce.com Selenium Camp
  2. 2. Talk Outline ● Website Building Tools ● Talk Motivation ● Testing: Design Time vs. Runtime ● UI Abstraction ● Generalizing Tests ● Developers in Testing ● Best Practices ● Example: Writing a New Test ● Nuances of WebDriver
  3. 3. Website Building Tools Source: WordPress[2]Source: Salesforce Lightning Bolt[1]
  4. 4. Talk Motivation Website Builders require testing to happen in two main contexts: ●Design time ●Runtime It is entirely different from general, single context testing.
  5. 5. Main Testing Concept Design Time Runtime Separation of Design Time and Runtime Source: Salesforce Release Notes - Winter’ 161] Source: Salesforce Developer - Communities[2]
  6. 6. Testing: Design Time ● Set Up the Data For Tests ● Design Time -> POMs ● Focus: Relation of POMs ● PageFactories or plain POMs Highlights Source: Salesforce Release Notes - Winter’ 161]
  7. 7. Testing: Runtime ● Use a single iFrame/POM ● Use WS via JavascriptExecutor ● Focus: Connection of Actions ● Main Pattern: FluentInterface Source: Salesforce Developer - Communities[1] Highlights
  8. 8. UI Abstraction Plain PageObjectModel PageFactory What Approach To Use?
  9. 9. Generalizing Tests Testing Different Templates Source: Salesforce Release Notes - Winter’ 171]
  10. 10. Generalizing Tests - Continued Browse Compatibility Source: Browser Market Share Worldwide, StatCounter[1]
  11. 11. Developers in Testing API First TDD-like Mindset Source: Dreamstime[1]
  12. 12. Best Practices in Design Time and Runtime Do: ● Abstract WebDriver - no raw WD libraries ● Use CSS Selectors first ● Setup data before starting WD Session ● Keep Test Atomicity in mind Don’t ● Fall into extremes when creating POMs ● Reuse the same session ● Use Thread.wait(...) ● Use WebDriver for all test cases
  13. 13. Example: Writing tests 1.Review dev code Let`s Say I got a new Code... 2. Confirm selectors Source: Salesforce Stock Images[1]
  14. 14. Example: Writing tests - Continued 3. Introduce abstractions Let`s Say I got new Code... 4. Add WS hooks
  15. 15. What Drives Me Crazy About WD ● Retrieving Console Logs • Lots of Driver Bugs • Requires Constant pulling ● Browser Drivers' support • Very small support teams ● Internet Explorer • Mostly unreliable ● Relatively slow tests • In compare to functional or unit tests
  16. 16. Why WebDriver Tests? End-To-End Testing Best Tool of Agile Engineer Regression Testing
  17. 17. Alternatives to WebDriver? ● E2E tests (Applitools/Sikuli Script) ● Functional Tests (WS-based) ● Integration Tests (Mockito, PowerMocks) ● Performance Tests (Gatling, JMeter) ● Unit Tests (JUnit, TestNG) Right tool for the right problem
  18. 18. Test Pyramid
  19. 19. Final Words Write Test Code Like You Mean It Source: Salesforce Stock Images[1]
  20. 20. Q/A
  21. 21. About Speaker Twitter: @DmitryVinnik LinkedIn: in/dmitry-vinnik/ Email: dvinnik@salesforce.com Dmitry Vinnik

×