Thursday, May 21, 2015

Technical task. Test automation for web-page.

Recently I was asked about preparing of test-automation for the page http://hh.ru/price.
Major agreement: Java and Selenium.
So I would like to share several steps and ideas how I tried to solved required challenge.
I've created the Maven project to avoid problems with dependency for Selenium:


Adding Selenium dependency

Choose version of Selenium

To solve this task I preferred to show several technics, because adding tests with good architecture should not be difficult thing.

  1. Most significant challenge here is to use both Page Factory and Page Object patterns. In the Internet we may find a lot of examples how to use that and how to work with that. I would like to share several of examples that I used:
    1. Selenium | Introduction to Page Object Classes | Tutorial #6
    2. Selenium | Introduction to PageFactory | Tutorial #7
    3. Selenium | Creating Flexible Selenium Tests | Tutorial #8
    4. Selenium | Creating Base Class For Page Objects | Tutorial #10
    5. As well as these video tutorials, following link can be useful to understand full picture. It is a basic description of technics from Selenium page:
      1. PageObjects
      2. PageFactory
  2. After that I've added functionality to work with localization. Just to make sure that such functionality will be supported from the beginner. 
  3. Also I've noticed that item that added to cart may have another description that description on the page. It is different strings but with the same meaning. So, I've added required mapping to the project.
In a bit more details:
For case #1, I've added base page and pages the related to different types of services. Processing of the cart has been added to base page's functionality. Also each page used PageFactory pattern to initialize main components
For case #2, I've added xml's with localization and functionality selects required list of strings due to initialization.
For case #3, I've added additional xml with mapping between services' descriptions. This functionality also depends on case #2. So, mapping was between ids from localization, not between actual strings.

Also, I've used JUnit to test execution, so several links are here:
  1. JUnit parameterized
  2. JUnit and TestNG
Full version of my solution can be found here

No comments:

Post a Comment