Running automated QA tests against your web service every time you deploy to Heroku is the best way to complete your continuous integration pipeline. Using Heroku Review Apps along with our GitHub deployment integration makes this trivial using Assertible.

In this post I will demonstrate how to setup an automated continuous integration and continuous testing QA pipeline for a web app using Heroku and GitHub. This app will be setup to deploy all branches to a unique environment and runs automated API tests against the web app.

Goals:

Deploy every single pull request to a unique Heroku app (using Heroku Review Apps).

Automatically run API tests against the web service immediately after a deployment.

Steps:

1. Connect Heroku and GitHub

In the Heroku dashboard, navigate to the app you would like to test and click the Deploy tab.

In the Deployment method section, select GitHub. Next, in the Connect to GitHub section, select a repository (you may need to click Search, see the image below).

Once Heroku recognizes your repo, click Connect. This should enable new options titled Automatic Deploys & Manual Deploys. The heroku dashboard should indicate that GitHub is now connected. For more information about setting up Heroku w/ GitHub, check out the Heroku documentation.

2. Connect Assertible w/ GitHub

In order to automatically run API tests to validate your web service functionality after a deployment you should use Assertible. The first step is to connect Assertible with GitHub. If you don't have an account, click the link below:

Start testing your web services now!

Assertible is free to use. Contact us if you have any questions or feedback!

Once your Assertible account is ready, create your first API test by entering the URL of a web service or importing a Swagger spec. Once you have created a test, navigate to the Deployments tab. Click the Add to GitHub button found on the GitHub integration and select a repository.

NOTE! If you aren't using GitHub, there are several ways to automate API tests after you deploy your web service. See our deployments API docs for more details.

3. Create a pull request

At this point, Assertible is completely configured to receive deployment events from GitHub when your app is deployed. To initiate a deployment to Heroku, you can push a new pull request (you can also initiate a manual deployment from the Heroku dashboard).

As you're app is deployed, Assertible will update your pull requests with your web service's test status. If your API tests fail, Assertible will mark the status check on the PR as failing.

Continue the discussion

We love feedback! Tweet at me @creichert07 or @AssertibleApp and let me know what you think.

Resources and documentation

:: Christopher Reichert