Integrating Runscope with Codeship

In this tutorial, we're going to show you how to include Runscope API tests in your Codeship builds. We'll use a small Python script and Trigger URLs, and we'll change the build status based on the results of your Runscope API test runs.

We'll cover how to:

Let's get started!

Getting Your Runscope Variables

Trigger URL

When running this script from the command line you can pass one parameter to it, which is a Runscope Trigger URL. If you want to run a single test, you can find its trigger URL under your environment settings:

Runscope environment settings menu expanded, showing the contents of the Trigger URL tab

If you want to run all the tests in a bucket, you can find a separate trigger URL in your bucket settings:

Runscope dashboard view, with an arrow pointed to the Bucket Settings link on the top-right corner

Runscope Bucket Settings page, showing the Trigger URL section the user can use to trigger all tests in a bucket

Make sure to copy the Trigger URL you wish to use, so we can use it with our script in the next steps.

Generating Your Runscope API Key

We need a Runscope personal access token to interact with the Runscope API and retrieve the results from our test run.

To get your access token, head over to your account's application tab, and click on Create Application. In the next screen, give your application a name, website URL, and callback URL. You can use dummy URLs if you're just using this app for your CI integration (e.g.

Runscope Create Application page, with the required fields containing the dummy URL

Click on Create Application to finish the process. Then, scroll down to the bottom of your new application page and copy the personal access token value. We're going to use that in our next step:

Runscope Application detail page, highlighting the Personal Access Token section found at the end of the page which includes the Access Token variable

Setting up the Runscope Python script

You can find the sample script in our GitHub:

The two files we're interested are requirements.txt and For this tutorial, I'm just going to work with the raw links from our GitHub repository.

If you're integrating this into your project, I highly recommend either forking it to your own repository, or adding these files to a separate folder. That way, you can prevent your build from breaking in case there's an update to the repository.

Integrating the Script with Codeship

In your Codeship account, select the project you're working with and click on Settings:

Codeship project dashboad page, with an arrow pointing to the settings buton under the project name

On the left-hand side menu, click on Environment. We only need to add one environment variable here named RUNSCOPE_ACCESS_TOKEN. Paste the value that you copied in our previous step for it, and click on Save Configuration:

Codeship project settings page, with the Environment menu selected on the left-hand side, with a variable RUNSCOPE_ACCESS_TOKEN added

Now, select Test on the left-hand side menu. The Codeship environment already comes with python and pip pre-installed. The first thing we need to do is make sure the necessary packages for the script are installed. Add the following command to your Setup Commands window:

pip install -r

Note: Remember to change the requirements URL above to your fork or local file.

Next, let's add another command just below it to download our file (you can skip this step if you copied the file to your project):


Codeship project settings page, with the Test tab selected on the left-hand side, and highlighting the Setup Commands textbox with the pip install and wget commands added to it

Finally, under the Configure Test Pipelines header, in the Test Commands window, we can run our script. It takes one parameter, which is the Trigger URL you copied at the beginning of this tutorial. So we can just run the command as:


Note: Remember to use the correct directory for if you copied it to a folder inside your project, and change the URL after `` to your tests Trigger URL.

Codeship project settings page, with the Test tab selected on the left-hand side, and the Configure Test Pipelines textbox highlighted with the python command added to it

Continuous Integration Complete

In your next build runs, you should be able to see an extra step running the Python script, and hopefully returning a green checkmark ✅:

Codeship build detail page, showing a succesful run and highlighting the python step being executed

You're all set!

Integrating with Codeship Pro

Codeship Pro is a more advanced offering from Codeship. It offers you more control and customization over your CI process, and includes native Docker support.

If you're using the Pro plan and want to integrate your workflow with Runscope API tests, we created a sample project that you can find here:

It's based on Codeship's tutorial project, and it includes instructions on everything you need to set it up. When you run it, it will spin up a separate container to run your Runscope API tests, in parallel to the sample Ruby application.

Having trouble configuring Codeship? Contact our support team.