Continuous Integration and Load Testing

Continuous integration (CI) is a widely accepted way to speed up your software development process, by merging code frequently and testing through automation. Many teams run automated functional test suites as part of their build and deployment process.

It’s also a great idea to include load and performance testing in your continuous integration pipeline! Automating load tests with every build or deployment can help you detect performance regressions quickly, and also uncover certain kinds of bugs that might only surface when the system is under load.

Starting Tests with with the Loadster CLI

The Loadster CLI is the easiest way to launch Loadster tests from your CI pipeline, build server, or cron job. It’s available as a self-contained native binary for Windows, Mac, and Linux, and makes running and observing load tests a breeze.

To start a test:

$ loadster start WsHDupkZEYkSD7bT

To run a test and wait for it to finish, evaluating assertions:

$ loadster run WsHDupkZEYkSD7bT --assert="totalErrors == 0" --assert="averageResponseTime < 0.5"

Check out the Loadster Command Line Interface documentation for general help with installing and using the Loadster CLI.

Starting Tests with Your HTTP Client

If you don’t want to use the Loadster CLI or it’s unavailable on your platform, you can also run and observe tests with your HTTP client of choice. For this example, we’ll use curl.

Making a POST to your scenario’s trigger will start the test:

$ curl -X POST https://api.loadster.com/cloud/triggers/WsHDupkZEYkSD7bT
{
  "message": "Test launched!",
  "reportUrl": "https://loadster.com/dashboard/projects/2e05873a-6119-426d-bf45-25858c7d797e/scenarios/5390b231-40bd-4897-9922-733d2479e436/tests/2a8d9a67-2708-435a-8aec-5fc462323632",
  "statusUrl":"https://api.loadster.com/cloud/triggers/WsHDupkZEYkSD7bT/status/15d27a12-f970-4c62-8284-485b48851cad"
}

If you want to keep an eye on the test as it runs, or cause your CI process to wait for the test to finish, you or your CI script will want to make note of these URLs.

Although starting a test with curl is easy enough, we recommend using the Loadster CLI instead of curl if it’s available, because it can evaluate pass/fail assertions and other things besides just starting a test.

Tracking Test Results from Continuous Integration

Finished tests will show up in the activity feed on your dashboard, alongside tests that were started manually by you and others on your team.