CI/CD Integration
Since Jikken tests already live in your code repository, and running them is as simple as executing a CLI command, it’s easy to integrate them into your existing CI/CD pipeline.
Here, we’ll show what your configuration might look like in order to run tests after each deployment, with examples for GitHub Actions, CircleCI, and Jenkins.
Installation script
We provide a simple installation script that can be used to install the latest version of Jikken via curl
, with no other required tooling.
This script was designed for the CI/CD use case, and will be used as the installation method in our examples.
Please note that the script only supports Linux systems.
It is available at https://jikken.io/install.sh
.
Check out our installation docs for other ways to install Jikken on Linux, Mac, or Windows.
Variables & secrets
You may need environment variables and/or secrets for your test execution. For example, if you’re using the Jikken cloud platform, an API key is required in order to stream telemetry data.
In the examples below, we using environment variables to specify the Jikken environment and the base URL for the APIs we’re testing, and secrets to specify our API key and a test user password.
See the documentation for your CI/CD provider to review how to configure variables and secrets.
GitHub Actions: variables, secrets
CircleCI: variables
Jenkins: credentials
Example files
GitHub Actions
This workflow file has a test
job, which executes after deploy
has completed, and specifies an environment for variable resolution.
The job has steps to install Jikken (via the provided script) and execute all tests in a specific directory.
We inject the variables for the Jikken environment and API key, as well as custom global variables for the base API URL and some user credentials to be used in a test.
We also use the --junit
option when running Jikken to output a JUnit XML test result file, which is then uploaded as a jikken-test-results
artifact in the last step.
Note that the upload step is configured to always run, to ensure our results are still uploaded in the case of test failures.
See the official documentation for more details on GitHub Actions and workflow files.
CircleCI
This configuration file has a test
job with steps to install Jikken (via the provided script) and execute all tests in a specific directory.
We inject the variables for the Jikken environment and API key, as well as custom global variables for the base API URL and some user credentials to be used in a test.
We also use the --junit
option when running Jikken to output a JUnit XML test result file, which is then stored in the last step.
The store test results step will always run, so that we still see the results if any tests fail.
We then configure the workflow so that our test
job is dependent on the deploy
job to run, and ensure that it uses the correct context for our variables.
See the official documentation for more details on CircleCI and configuration files.
Jenkins
This Jenkinsfile has a 'Test'
stage, which executes after 'Deploy'
has completed.
The stage has steps to install Jikken (via the provided script) and execute all tests in a specific directory.
We inject the variables for the Jikken environment and API key, as well as custom global variables for the base API URL and some user credentials to be used in a test.
We also use the --junit
option when running Jikken to output a JUnit XML test result file.
We then configure a post step where we use the junit
plugin to report our test results.
Note that we specify a condition of always
, to ensure our results are still uploaded in the case of test failures.
See the official documentation for more details on Jenkins and Jenkinsfiles, and find information on the JUnit plugin here.