This add-on is operated by Rainforest QA, Inc
Insanely simple testing.
Last updated 22 February 2016
Table of Contents
Rainforest allows you to setup blazing fast integration tests and run them against your app against all major browsers in under thirty minutes. Faster than automated testing. Light-years quicker than manual testing.
We’ve designed Rainforest for continuous deployment. We have plugins to integrate seamlessly into your existing deployment workflow. If you get a failure with Rainforest, we fail your build just like Rspec.
Provisioning the add-on
Rainforest can be attached to a Heroku application via the CLI:
A list of all plans available can be found here.
$ heroku addons:create rainforest -----> Adding rainforest to sharp-mountain-4005... done, v18 (free)
Rainforest requires zero configuration in your application; you should start by going to the dashboard to create your first test.
For more information on the features available within the Rainforest dashboard please see the docs at docs.rainforestqa.com.
The Rainforest dashboard allows you to manage tests, request runs and to view results.
The dashboard can be accessed via the CLI:
$ heroku addons:open rainforest Opening rainforest for sharp-mountain-4005…
or by visiting the Heroku Dashboard and selecting the application in question. Select Rainforest from the Add-ons menu.
Writing your first test
- Goto sites and add www.twitter.com as a site.
- Click “New test”.
- Click “Unnamed Test”. Enter a relevant title for your test. In our case “Login into Twitter” would be a good name.
- Click “Test URL”. Pick twitter.com from the drop down. You can also enter path for the tester to start on. In our case “/login” (and not “https://twitter.com/login”).
- Click “Add initial step”.
A step contains an action and a question for the tester to answer. The question should be answerable with yes or no. The question should be phrased so that yes is a success and no is a failure.
Our sample step action is going to be “Enter the username ‘rainforest-twitter-example’ and password '8423ufdslk’”.
Our sample step question will be 'Have you been logged in?’.
Lets create another test named “Send a new tweet”. Be sure to set the site to “Twitter.com”.
Enter a second step with the action “Locate the compose a tweet box and enter the current date and time. Then, Click the 'tweet’ button.” And the response: “Was the message you added displayed on the Tweet Stream?”
Now, since we can only send tweets when we’re logged in, we want to reuse the first test we wrote which tests the login as part of this test, so our tester is logged in before trying to tweet.
Click “Embed a test” and type “Twitter” or whatever the name of your first test was. When it appears in the drop down, click to select it . Drag the newly added step to the top of the steps so it gets executed first.
In this way it’s simple to re-use existing tests and keep your test suite modular and easy to maintain.
Integrating with your CI Server
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 system or with your 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.
It’s easy to install (requires ruby 1.9 or newer):
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 integrations pane of your account.
--fg option ensures that the command only returns when the run is complete. If you do not specify it, the tool will trigger the run, but will then exit immediately.
--fail-fast option makes the rainforest tool return immediately after the first failure.
For all options, refer to the Github page of the tool.
The perfect workflow will of course depends on your application and your specific needs. Here are a few that we find work well.
We found it extremely powerful to have our CI server handle our deployments. We’ve configured it to deploy to our staging server whenever new code is merged into the
When new code is merged into that branch, the following happens:
- All the units tests are run
- The code new code is pushed to your staging server, database migrations are run, etc
- The rainforest tools triggers a new run of all your tests against the staging server
Once all your tests are green, you can confidently deploy that code to your production server. Hopefully, your process is as simple as merging the
staging branch into the
production branch. This triggers a deploy to production and you code is now live and bug free.
Running Only Specific Tests
The easiest to achieve this is to use tags. If you tag all of your tests with a tag named
run-me, you can do so with the following command.
rainforest run --token <YOUR API TOKEN> --tag run-me --fg --fail-fast
You can also use tags to only run a subset of tests that correspond to the subsystem being deployed.
If the command line interface does not provide enough flexibility for your needs, we also have an API that you can use directly.
If you find you get unexpected failures in your tests, this may be for a number of reasons. Common reasons include;
- Using domain specific knowledge
- Unspecific instructions or questions
You can request help by contacting us via the web interface.
Migrating between plans
heroku addons:upgrade command to migrate to a new plan. Your plan change will be reflected immediately.
$ heroku addons:upgrade rainforest:newplan -----> Upgrading rainforest:newplan to sharp-mountain-4005... done, v18 ($49/mo) Your plan has been updated to: rainforest:newplan
Removing the add-on
Rainforest can be removed via the CLI.
This will destroy all associated account data and cannot be undone!
$ heroku addons:destroy rainforest -----> Removing rainforest from sharp-mountain-4005... done, v20 (free)
All Rainforest support and runtime issues should be submitted via on of the Heroku Support channels.