This project automates a selection of functional tests on multiple browsers using Geb integrated with Spock and Gradle. It helps to varify that new changes have not created regressions. The test strategy for this project is discussed on the mds confluence page: https://apps.nrs.gov.bc.ca/int/confluence/pages/viewpage.action?pageId=39651197 (accessing this page will require IDIR login)
A Selenium WebDriver wrapper which integrates well with Groovy and Spock syntax and provides flexibility working with multiple browsers and simplicity on writing tests.
A testing framework whose Arrange-Act-Assert structure best matches the BDD's(Behaviour Driven Development) Given-When-Then scenario description format.
A build tool to build the groovy project and manage its dependencies.
build.gradle
: Build configuration for Gradlegradle.properties
: Environment properties used in the Gradle buildgradlew(.bat)
: Gradle runner executablesrc/test/groovy/resources
: Configuration for Gebsrc/test/groovy/<Project Name>/spec
: Specification for test cases/scenariossrc/test/groovy/data
: SQL to create/delete test data directly from the DBsrc/test/groovy/<Project Name>/modules
andsrc/test/<Project Name>/pages
: Definition of modules/pages in the appsrc/test/groovy/utils
: Constants being used in the test script
Follow the .env-example
template to create an .env
file under
/functional-tests
with valid IDIR credentials and database connection
information before running the test.
The following commands will launch the tests with the individual browsers. They must be run in the functional test (current) directory. The minespace-frontend tests are run by replacing CustomJUnitSpecRunner with CustomJUnitPublicSpecRunner
The shell script controlling how the tests in the pipeline are run is run_test.sh. If new test suites need to be added to the GEB testing process this is where they will be added.
The core frontend tests here will be run with the following commands ./gradlew chromeTest -DchromeTest.single=CustomJUnitSpecRunner ./gradlew chromeHeadlessTest -DchromeHeadlessTest.single=CustomJUnitSpecRunner //download tsf test will fail due to chrome-headless bug ./gradlew firefoxTest -DfirefoxTest.single=CustomJUnitSpecRunner ./gradlew firefoxHeadlessTest -DfirefoxHeadlessTest.single=CustomJUnitSpecRunner
- Replace
./gradlew
withgradlew.bat
in the above examples if you're on Windows.
Only on windows:
gradlew.bat edgeTest -DedgeTest.single=CustomJUnitSpecRunner
gradlew.bat ieTest -DieTest.single=CustomJUnitSpecRunner
Report can be found under /functional-tests/build/reports/tests
This often occurs when a new table is added to the database and the clean up script attempts to delete a linked table. Often running the test on a clean database will work. Though sometimes the data_deletion.sql script will have to be modified to delete dependancies before proceeding.
If you've never managed to run the functional tests locally before, confirm that your .env file matches the .env example. You will need to get the password from openshift secrets.
You may be running postgres locally for a different project. You should
stop that process and then run make db
in the project root.