Giter VIP home page Giter VIP logo

selenium-java-bootstrap's Introduction

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

Pipelne 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

selenium-java-bootstrap's People

Contributors

eliasnogueira 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.