noms-digital-studio/licences-feature-specs

Name: licences-feature-specs

Owner: NOMS Digital Studio

Description: End-to-end tests for the Licences application

Created: 2017-09-18 08:39:41.0

Updated: 2018-05-24 09:55:30.0

Pushed: 2018-05-24 09:55:29.0

Homepage: null

Size: 11385

Language: Groovy

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

licences-feature-specs

End-to-end tests for the Licences Application see http://www.gebish.org/manual/current/

Pre-Requisites
Environment

The following environment variables must be set:

Note that you can set values for the Database environment variables in a config.properties file in the project root.

The Licences application must be running at Licences_URI, and must be connected to a database and a nomis api or suitable mocks.

Note that for running against Mock or Stage in CircleCI we need to supply environment specific values for properties such as TEST_DB_USER. In the Circle CI environment variables we supply Stage specific variants eg TEST_DB_USER_STAGE. In .circleci/config.yml we take TEST_DB_USER_STAGE and use it tro replace TEST_DB_USER eg export TEST_DB_USER=“$TEST_DB_USER_STAGE”

Execution

In src.test/resources/GebConfig.groovy you can change from headless mode (Phantom JS) to browser mode with ChromeDriver. If not using the bundled Linux ChromeDriver, set the webdriver.chrome.driver property with your ChromeDriver path.

Run with gradle or execute a specific test using your IDE.

./gradlew test or ./gradlew mockTest - executes all specs

./gradlew stageTest - executes only specs marked with @Stage

Writing Specs
Stepwise specs

This means that the tests in a spec are executed from top to bottom. This means that each test depends on the prevous tests. Disadvantage is not being able to run an individual test. Advantage is not having to login and navigate back to the same page again.

When adding or changing tests, consider the context assumed by existing tests.

Stage specs

Use the `@Stage' annotation on a spec or a test to mark it for execution against the stage environment.

Because this is a subset, consider what the context will be if previous tests in a Stepwise spec are not executed.

Specs or individual tests should be tagged for stage only if they depend on an interaction with the nomis elite2 api. If it doesn't use elite2, then there's no difference between mock and stage.

This only needs to include a few key tests that exercise the elite2 api interaction, not an exhaustive duplication.

Test Data

Automated tests emply user accounts specific for automated testing eg CA_USER_TEST.

They also use a naming convention to identify test data exclusive to automated tests. Any test data for an automated test should use a Nomis ID / offender number ending with 'XX' eg A0001XX


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.