Using the Jenkins Plugin

The API Fortress Jenkins Plugin allows you to run tests during automated builds. The tests that fail may, or may not, cause a build failure based on your settings.

Watch the walkthrough video.

Install the Jenkins plugin

From the Jenkins Update Center, search and install the API Fortress plugin.

jenkins1A Jenkins restart may be required. You will be prompted accordingly.

Configure a build step

Add the API Fortress build step where it best suits your needs.

jenkins2

Modes

There are 4 testing modes available. “Run single test” will run a single test, while the others will run suites of tests.

Run Single Test

You can run a single test by providing a test ID. Test IDs can be found in test interstitial pages.

See where to retrieve the test IDs later in this document.

Run Automatch

You can run our “automatch” mode by providing a URL representing a certain endpoint. You can configure automatch patterns in the “Automatch” section of each test. Read more about automatch here .

Run by Tag

Choosing “by tag” will run multiple tests marked with a certain tag. Tags can be added and edited in the test details.

Run Project

By running a full project, you will be running all tests contained in the project.

Hook URL

The hook URL is an API endpoint that references a specific project within an API Fortress environment.

See the Hook URLs section to create one.

Options

The following options can apply to any mode.

Blocking

The plugin can silently run (blocking = false), which lets the build continue with a success and inform you if the test failed using the various methods available. Or it can actively determine the build success (blocking=true), so that the build will wait for the tests result and stop the build if the tests fail.

Dry-run

If checked, no events will be stored within API Fortress. To be used in conjunction with “blocking.”

Silent

If checked, no alerts will be sent if the tests fail.

Parameters Override

You can override up to 3 parameters in the test scope. These variables will appear within the test scope just like any other variable. Useful if you are looking to override the domain of the service being tested (ie. staging vs production).

Hook URLs

Hook URLs are API endpoints representing one of your projects. These endpoints have unique paths, and do not require authentication for most non-disclosing operations.

To create a Hook URL:

  1. Access your API Fortress dashboard.
  2. Enter the company configuration screen (gear icon in the top right).
  3. Choose API Hooks on the side menu.
  4. Create a new Hook by choosing the user (necessary for advanced functions) and the project.
  5. A unique URL will be generated. That is the URL to be used in your build step configuration.

Test IDs and Project ID

To retrieve a specific test ID from the API Fortress dashboard:

  1. Access the tests list for the project you intend to use.
  2. Edit one of tests and access the interstitial page.
  3. Click on “show/hide test information.”
    jenkins4
  4. The test ID and the Project ID are shown here.