Giter Club home page Giter Club logo

seleniumuiframework's Introduction

Auto Selenium UI Framework

Introduction

Hi All, I created this UI Framework in order to automate Web Applications.

Application Under Test

Orange HRM - Dummy UI Application for UI Testing

Pre-Requisite

  1. Java 11 - as the language of choice for writing this test framework.
  2. Maven 3.8.2 - for project dependency management.
  3. Any of your favorite IDEs (I prefer IntelliJ, but code is independent of any IDEs)

Core Features

  • Can Automate UI, irrespective of any Application under Test. Had implemented this by Encapsulating Driver and WebElement features under IDriver and IWebElement interfaces. Moreover, user can implement Logging for Driver and WebElement feature using Decorator Pattern using the above-mentioned Interfaces.
  • Use Thread Local for WebDriver so that while running automation in parallel, each Thread can use different driver instances.
  • Users can provide a Browser Name to be used for executing test cases under env.properties file. By default, browser used is Chrome. But user can change the value at runtime to any other. If no value is specified, then by default browser is Chrome, but in case you need to override the value, please use as browser=firefox under env.properties.
  • Use Selenium in order to automate browser.
  • Use Junit5 Reporting.
  • Use PODAM library to autofill Java POJOs with random fake data.
  • Use Fixture Factory Library in order to build and organize fake objects for tests using template format. For further understanding check out the EmployeeDetailsTemplate file inside the project.
  • Use Owner Library in order to fetch properties file data using a simple Annotation-Based Approach. The user is not required to code for loading, converting, and managing of properties files.
  • Use Junit 5 in order to Parameterize the Tests.
  • Use Parallel Execution for which configuration is available under junit-platform.properties.:

Challenges Faced

  • Encapsulated Driver Related Functionalities (like start a driver, quit a driver, findElement/s) inside Driver Interface to hide complexities from different other modules like Page Layers.
  • Encapsulated WebElement Functionalities (like sendKeys, click an element, upload Images etc.) inside WebElement Interface to hide complexities from different other modules like Page Layers.
  • While searching for any element we face issues like Element is not present/ visible / enabled, in order to overcome this we use Explicit waits but it becomes too noisy to use to each and every place. Solution: Whenever a user tries to find an element under WebPage, Explicit Waits are added which are present as low-level design so that user does not need to take care of it additionally, and they can just call (driver.searchElement(By by))
  • While executing test cases in parallel we face issue that each thread tries to modify or use same instance of WebDriver and since WebDriver is not Thread-safe we face un-expected behaviours. Solution: Implemented Thread Local, for WebDriver so that while running automation in parallel, each Thread can use different driver instances.
  • Segregating Page Layers Solution: Used Page Object Model design pattern for this.
  • It becomes very difficult to create and maintain POJOs.
    Solution: Used PODAM library for same, it autofills POJOs with random fake data.
  • There is a lot of boilerplate code involved when trying to fetch data with a property file in Java.
    Solution: Used Owner Library in order to fetch properties file data using a simple Annotation-Based Approach.
  • How to provide Parameterize test with random data into it.
    Solution: Used Junit5 in combination with a Fixture Factory library in order to create random parameterized data.

Tools Set

  1. Java 11 - as language of choice for writing this test framework.
  2. Junit5 - as a testing framework for the Java programming language.
  3. Maven 3.8.2+ - for project dependency management.
  4. Selenium - in order to automate browser.

Steps to Execute

  1. Use the below maven command in order to execute test cases
mvn clean test -Denv=<environment> -D<environment>_username=<username> -D<environment>_password=<password>

Here :
a) environment: It will be based on env.properties file (currently it is either PROD / QA but user can add multiple as required)
b) Username and Password: It can be fetched from Testing Site

For eg :

mvn clean test -Denv=prod -Dprod_username=Admin -Dprod_password=admin123
  1. Use the below command in order to generate a Junit HTML report.

In order to generate a report, you just need to add 'site' at the end of mvn clean test command as below :

mvn clean test -Denv=<environment> -D<environment>_username=<username> -D<environment>_password=<password> site
  1. Report will be generated under below directory structure, you can open the report in any browser of your choice
target/site/index.html

seleniumuiframework's People

Contributors

kislaya1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.