Integrating Rainforest With Your CI
Rainforest is the simplest way of doing integration testing. Since integration tests play such a big role in assuring the quality of your software, it is important to run these tests on a regular basis.
The best way to achieve this is to integrate Rainforest with your existing continuous integration or deployment system. We've built a tool that lets you achieve this in minutes.
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. This tool is called rainforest-cli and is compatible with all build systems.
You can easily install it with
gem install rainforest-cli. You can then run all of your tests using the following command:
rainforest run --token <YOUR API TOKEN> --fg --fail-fast all
You can find your API token in the settings section of your account. In order to use with your CI, simply add the above line to your build script after your deployment is complete.
A Real World Example
Our own CircleCI build configuration looks like this:
deployment: staging: branch: develop commands: - git push -f firstname.lastname@example.org:rnfrst-qa.git $CIRCLE_SHA1:master - heroku pg:reset DATABASE --app rnfrst-qa --confirm rnfrst-qa - cat db/structure.sql | heroku pg:psql --app rnfrst-qa - heroku run rake db:seed --app rnfrst-qa - heroku restart --app rnfrst-qa - "curl https://app.rnfrstqa.com/ > /dev/null" - bundle exec rainforest run --token <OUR API TOKEN> --tag run-me --conflict abort --fg --fail-fast
This deploys to our QA server, resets our database and seeds it with test data. We then trigger all the tests that are tagged
run-me using the
--tag option flag.
Now every time we merge new code into our
develop branch, this code gets deployed to our server and all our Rainforest tests are run against that server.
For the complete documentation on how to integrate with a CI, refer to our documentation site. If the command line interface does not provide enough flexibility for your needs, we also have an API that you can use directly.
Happy testing!Filed under: continuous integration