Rainforest makes it easy to integrate testing into your release process. Configure virtually any CI tool to run Rainforest tests as part of your CI/CD pipeline. For more information, see:
To integrate Rainforest with any CI server or deployment tool, we wrote a command-line interface that triggers a run of your tests from any script. For more information, see How to Install the CLI.
Run all your tests using the following command:
rainforest run --token <YOUR API TOKEN> --fail-fast --description "CI automatic run" all
You can find your API token in the Settings > Integrations page of your Rainforest Account.
--fail-fast option makes the Rainforest tool return immediately after the first failure.
--description option adds an arbitrary description to the run.
For a comprehensive list of options, refer to our open-source project.
To view examples of how to configure standard CI tools to automatically run your test suite, see our CI Sample Repository.
The Rainforest CLI supports triggering based on the contents of a
git commit message. This is useful when Rainforest is integrated into your CI server, but you want more control over what is tested.
To enable this feature, add
--git-trigger to the command line options you pass to Rainforest. With this flag enabled, the CLI client does nothing unless the last commit message for your project contains
@rainforest and one or more hashtags. Here’s an example:
"Fixed the login button" is the last commit.
Instead of triggering
rainforest "Fixed the login button. @rainforest #login", we start a
rainforest run with anything tagged
git-trigger to enable teams to test feature branches for speed before your work is merged into a release branch. For more details on how to get started with this workflow, contact our Support team.
For the whole picture, we encourage you to consult CircleCI’s Getting Started documentation. If CircleCI is already set up, check out our CircleCI Orb to easily integrate Rainforest tests into your CI flow.
The primary way to configure the CircleCI tool is to store a file in your git repository. You can see the sample configuration for our project here.
Notice that instead of entering the Rainforest API key directly in the
config.yml file, we use environment-specific test datatest data - Placeholders that allow you to inject other values into your tests. Rainforest supports three types: dynamic, static, and built-in.. We do this for security reasons. We don’t want to expose sensitive information to any reader of the file, especially when the repository is public. For more information, see Using Test Data.
RAINFOREST_TOKEN environment variable in CircleCI corresponding to your test data, and you’re done. For more information, see CircleCI’s Using Environment Variables.
Our project is configured to provide a continuous delivery flow by default. Every time code is pushed to the
develop branch, CircleCI:
- Runs the automated tests.
- Deploys the
developbranch to a staging server.
- Runs the Rainforest tests using the CLI on the staging server.
- Once the Rainforest tests are successful, CircleCI pushes the
developbranch to the
- The previous step triggers another CI build, which pushes the code to production.
If any step fails, the build fails. This prevents the deployment of broken code to your users.
You can test your setup by committing a change to your
develop branch and pushing it to your git repository. CircleCI picks up the change and deploys your code. With a new continuous delivery flow and QA process, you can move fast while not breaking anything.
Note: If you don’t see an API token in your Rainforest settings, click the Rotate API Token button to generate a new one.
If you have any questions, reach out to us at [email protected] or via the chat bubble below.
Updated 4 months ago