To join the conversation, we're on the OpenActive Slack at #openactive-test-suite.
The general aim of this project is to allow end to end testing of the various flows and failure states of the Open Booking API.
This repository hosts two different projects:
- Broker microservice: this sits in between the test suite and the target Open Booking API implementation. This allows the integration tests to watch for changes to the various RPDE feeds.
- Integration tests: this performs automated tests against the API.
The Roadmap provides an overview of upcoming development milestones, and contributions are welcome.
For more info, read the individual README.md within the package directories:
Before running, configure the test suite:
packages/openactive-broker-microservice/config/default.json
packages/openactive-integration-tests/config/default.json
A local.json
file can be placed alongside each default.json
, and the subset of properties defined within it will override those in default.json
. It is recommended that for development and deployment a local.json
file is created instead of making changes to the default.json
file, so that any new required settings that are added in future versions can be automatically updated in default.json
.
A file named {NODE_ENV}.json
can also be placed alongside the default.json
, which is useful when maintaining multiple configurations.
For more information see the documentation.
npm install
This will install the dependencies needed for both packages.
For developers that are customising the installation, for use in e.g. Docker, the directory ./packages/test-interface-criteria
is a dependency, and so must be present during npm install
.
npm start
This will start the broker microservice (openactive-broker-microservice
) and run all integration tests (openactive-integration-tests
) according to the feature configuration. It will then kill the broker microservice upon test completion. The console output includes both openactive-broker-microservice
and openactive-integration-tests
. This is perfect for CI, or simple test runs.
Alternatively the Broker microservice and Integration tests may be run separately, for example in two different console windows. This is more useful for debugging.
Any extra command line arguments will be passed to jest
in openactive-integration-tests
. For example:
npm start -- --runInBand test/features/core/availability-check/
Read about Jest's command line arguments in their CLI docs.
The configuration of the test suite can be overridden with the environment variable NODE_CONFIG
, where any specified configuration will override values in both packages\openactive-broker-microservice\config\default.json
and packages\openactive-integration-tests\config\default.json
. More detail can be found in the node-config docs. For example:
NODE_CONFIG='{ "waitForHarvestCompletion": true, "datasetSiteUrl": "https://localhost:5001/openactive", "sellers": { "primary": { "@type": "Organization", "@id": "https://localhost:5001/api/identifiers/sellers/0", "requestHeaders": { "X-OpenActive-Test-Client-Id": "test", "X-OpenActive-Test-Seller-Id": "https://localhost:5001/api/identifiers/sellers/0" } }, "secondary": { "@type": "Person", "@id": "https://localhost:5001/api/identifiers/sellers/1" } }, "useRandomOpportunities": true, "generateConformanceCertificate": true, "conformanceCertificateId": "https://openactive.io/openactive-test-suite/example-output/random/certification/" }' npm start
Defaults to 3000.
Set PORT
to override the default port that the openactive-broker-microservice
will expose endpoints on for the openactive-integration-tests
. This is useful in the case that you already have a service using port 3000.
E.g. FORCE_COLOR=1
Set this to force the OpenActive Test Suite to output in colour. The OpenActive Test Suite uses chalk, which attempts to auto-detect the color support of the terminal. For CI environments this detection is often inaccurate, and FORCE_COLOR=1
should be set manually.
Assuming configuration is set using the NODE_CONFIG
environment variable as described above, the test suite can be run within a continuous integration environment, as shown below:
#!/bin/bash
set -e # exit with nonzero exit code if anything fails
# Get the latest OpenActive Test Suite
git clone [email protected]:openactive/openactive-test-suite.git
cd openactive-test-suite
# Install dependencies
npm install
# Start broker microservice and run tests
npm start
Note that running npm start
in the root openactive-test-suite
directory will override waitForHarvestCompletion
to true
in default.json
, so that the openactive-integration-tests
will wait for the openactive-broker-microservice
to be ready before it begins the test run.