Skip to content
Bootstrap project to automate a webpage using Selenium WebDriver, Java and TestNG
Java Groovy
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
pipeline_as_code DriverFactory, Listeners and reporting changed because of a npe bug Sep 19, 2018
src license added Jan 23, 2020
.gitignore General refactoring Aug 26, 2018
CODE_OF_CONDUCT.md
LICENSE
README.MD Update Readme.MD Dec 16, 2019
docker-compose.yml general refactoring Nov 28, 2019
pom.xml webdrivermanager updated Jan 23, 2020

README.MD

The purpose of this project is to have a basic project with minimum viable testing architecture to automated web tests using Selenium WebDriver and Java as the programming language.

Languages and Frameworks

This project using the following languages and frameworks:

  • Java 8 as the programming language
  • TestNG as the UnitTest framework to support the test creation

Test architecture

We know that any automation project starting with a good test architecture. This project can be your initial test architecture for a faster start. You will see the following items in this architecture:

  • Use of Page Objects patters
  • Parallel execution
  • BaseTest
  • TestListner
  • Logging
  • Configuration through a properties file
  • yaml templates to create a Selenium Grid infrastructure on OpenShift

Do you have any other item to add on this test architecture? Please do a pull request or open an issue to discuss

Use of Page Objects patters

Parallel execution

BaseTest

TestListner

Logging

Configuration through a properties file

The project use the a property file to configure basic mutable items, like:

  • base.url: the main app URL
  • grid.url: target grid url
  • grid.port: target grid port
  • log.directory = the name of the log folder
  • log.dateformat = the data format for the log filename

The property file is inside conf folder. This folder has three sub-folders:

  • dev:
  • test:
  • prod:

You can set different values for the properties keys based on your environment. When you run a test without inform the parameter env, the property file used will be conf/dev/config.properties.

To change the environment, just use -Denv=env_name where env_name is the name of the folder inside conf folder.

E.g: running all tests using test configuration values

mvn test -Denv=test

Profiles executors on pom.xml

There is a profile called multi-browser created to execute the test suite multi_browser.xml inside src/test/resources/suites folder. To execute this suite, via command line you can call the parameter -P and the profile id.

Eg: executing the multi_browser suite

mvn test -Pmulti-browser

If you have more than one suite on src/test/resources/suites folder you can parameterize the xml file name. To do this you need:

  • Create a property on pom.xml called suite
    <properties>
        <suite>multi_browser</suite>
    </properties>
  • Change the profile id
<profile>
   <id>web_execution</id>
</profile>   
  • Replace the xml file name to ${suite} on the profile
<configuration>
   <suiteXmlFiles>
      <suiteXmlFile>src/test/resources/suites/${suite}.xml</suiteXmlFile>
   </suiteXmlFiles>
</configuration>
  • Use -Dsuite=suite_name to call the suite
mvn test -Pweb_execution -Dsuite=multi_browser

Pipeline as a code

The two files of pipeline as a code are inside pipeline_as_code folder.

Jenkins pipeline

You can you Jenkisfile on this directory and refer pipeline_as_code/Jenkinsfile on XXXXXX item on Jenkins. This pipeline works on

You can’t perform that action at this time.