ANY – Integrate With CI/CD Platforms (simple)

API Fortress was specifically built to make integrating with a CI/CD platform simple. Using our webhook you can execute API tests as part of your build and deployment flow, and get the results back in JSON or Junit format.

This is a general walk through of how that works, but we also have specific docs for:

Step 1 – Install an HTTP Plugin

Depending on your CI/CD platform, you may need to install a plugin that allows for HTTP requests during the build process. API Fortress will need that to execute the tests.

Step 2 – Generate an API Hook

The first step to integrating API Fortress into your CI/CD process is to grab the generated API hook for the project in question. To do so, head to the Settings panel in API Fortress. This view, seen below, can be accessed from anywhere in the application by clicking the Gear icon in the top right corner of the screen. Please note you need Manager access to generate a webhook. From Settings, click the API Hooks section and generate the hook for your project.

The next step depends on what you’re trying to test. The following steps are going to assume that you wish to run all of the tests in a project. You can also run a single test, or a series of tests with a certain tag. If you would like to learn more about that please contact API Fortress.

As it stands, our API hook is as follows:

The normal command to run all of the tests in the project, per the API Fortress docs is /tests/run-all, so we append this on to the end of the API call. You may need to request JUnit output. To do that simply takes some query parameters. First, we need to set sync to true, and then we can set format to JUnit. In short, we need to append ?sync=true&format=junit to the webhook call. That gives us the final API call:

Great! If we make this API call via a browser or a tool like Postman, we can see our results in JUnit. We’re almost there.

Step 3 – Execute HTTP Call From Your Platform

From your CI/CD platform’s dashboard, you’ll need to paste the webhook call to the flow. We have more specific docs, such as for Jenkins available.

The test results can then be passed along to platforms like qTest or Zephyr in your CI/CD pipeline.

Keywords: cicd, jenkins, bamboo, microsoft tfs, team foundation server, gitlab ci/cd, travisci