Automating load testing with the Load Impact API

Automating load testing as part of a CI Pipeline/build process is becoming increasingly popular and a best practice recommendation.  How often you run these automated tests will depend on the individual needs of your organization. Our general recommendation is with your nightly builds as that seems to be the closest to a one-size-fits-all approach. If you are using a Continuous Integration tool or want to build something yourself, we recommend one of the options below.  You can also schedule tests to run at regular intervals within our tool.

Before you start with either method below, you should have a test that you want to automate as well as thresholds set up to be your pass/fail criteria. Again, the exact criteria will depend on your needs, but you should think about:

What's an acceptable response time for a resource/page/API call?
What's an acceptable failure rate? Are any failures acceptable?



A. Using our CLI

To use the CLI, we have built this walkthrough you can use in app. (You must be logged in)

If you don't like guided walkthroughs, here are the steps for you to follow:

1. Get your v3 token here (If you already have a token, regenerating one will replace the old one. Only do that if necessary)
2. Download the CLI to the CI server.  You can access our GitHub repo for specific instructions.  If you use pip, you can run the command pip install loadimpact-cli
3. Once installed and configured with your token. Add a CLI call as a build step loadimpact test run TEST_CONFIG_ID 
Your test ID can be found by navigating to your desired test and grabbing the the test ID from the URL.  i.e. : https://app.loadimpact.com/tests/XXXXXXX

B. Using our Developer API

Load Impact provides an API that other applications can use to access the Load Impact platform.
To get access to the API (version 2) you need an API token.

Your API token provides access to your Load Impact account, so do not make it public and be careful with whom you share it. 
If you have an existing API token you can deactivate it by generating a new one.

Each token for the API (version 2) is unique to a user and organization and is restricted based on organization roles as follows:
  • Owner or Admin members can manage API tokens. 
  • Read/Write members can not access API tokens.

You will need to use an API token (version 2) when using the Load Impact API to programmatically manage your user scenarios, test configurations and test runs.
$ curl -X POST https://api.loadimpact.com/v2/test-configs/X/start -u "API_TOKEN:" {"id": TEST_RUN_ID_OF_STARTED_TEST}

The Load Impact API is commonly used when you need to automate your load testing efforts by integrating with   
your Continuous Integration & Deployment process to detect problems and performance regressions early in the development cycle.

Load Impact provides integrations with different servicesSDKs and examples in different programming languages.

Note: The Command line interface is for API version 3 (located at the integrations page).
The version 3 API will replace the version 2 in the near future but for now it can only be used in the Load Impact CLI.


Feedback and Knowledge Base