Skip to content

Technical documentation

jose.fernandez edited this page Aug 11, 2021 · 11 revisions

This section is targeted mainly to GingerSpec maintainers. If you just one to start using GingerSpec and create tests, head over the getting started page

Key concepts

Before we continue, it is important to remember, that GingerSpec is a library, that is, it is shipped like any other java library: as a jar file that you can include in the dependencies of your project. GingerSpec is managed by Github actions, which is responsible for publishing new releases to the maven central repository. So for working with GingerSpec, all you have to do is include the GingerSpec dependency in your Java maven pom.xml file (check the latest version of the library directly on the Github page here or in the maven repository here).

Requirements

In order to start working with GingerSpec and create new projects, you will need the following packages installed on your system:

  • Java 8+ (GingerSpec has been tested to work with Java8, 11 and 12)
  • Maven 3+

(Check out the Getting Started section for detailed instruction on how to create a GingerSpec-based automation project)

Compiling the library

After modifying, to check changes in your local project do:

mvn clean install

or, if you want to skip the tests:

mvn clean install -Dmaven.test.skip=true 

Running library integration tests

Running the embedded integrations tests in the library help to ensure that new changes haven't broken any existing functionality and is strongly recommended to run these tests before generating a new release. To make this process easier, there's a docker-compose file in the root folder of the project with the exact instructions on how to do this.

Testing with alternative SDK

If you want to test your changes in a different SDK, you can use the official docker images of maven in the following way:

First, create a docker volume where all dependencies will be stored (to avoid downloading all dependencies on every run)

docker volume create --name maven-repo

Run your maven commands inside the container (use the -v option to map the previously created volume):

docker run -it --rm --name gingerspec -v maven-repo:/root/.m2 -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.6.1-jdk-11 mvn clean install -Dmaven.test.skip=true

This will execute the command using Maven 3.6.1 and jdk-11. For the full list of supported tags check the official documentation here

You can also use the option --network host when testing the library using the included docker-compose

Tests execution

Head over to Running your tests section for up to date information on how to run your tests. Also, take a look at all the different possibilities and configurations GingerSpec provides for running Selenium features here

Other useful command-line options when running tests

  • -DlogLevel=DEBUG to see the DEBUG level of the automation project/library itself,
  • -Dmaven.failsafe.debug to debug with maven and IDE.
  • -DSHOW_STACK_INFO Shows information about the step definition location (the function that is being called in the background) together with information about the value of each parameter passed