Performance Testing via Artillery.io

Why Artillery?

Artillery offers many services that make performance and load testing faster and more reliable. Now let me outline a few reasons why I choose to use it over the better-known software.

1. Node.js tool

Java-based tools can be complicated and time-consuming to work with. Artillery.io is a Node.js tool with a basic СLI, which is a far simpler way to run performance tests.

2. Broad language support

Out of the box, Artillery.io will support:

  • Apache Kafka
  • Amazon Kinesis
  • HLS (HTTP Live Streaming)

3. YAML format

Unlike popular competitors’ testing tools, Artillery.io writes tests in YAML format which makes them readable and easy to understand. Artillery also supports a JSON format for testing.

4. Accessible scenarios

With Artillery’s scenarios and phases, you can build more flexible tests and cover multiple use cases in parallel. Also, it takes you just a few steps and conditions to set up tests for complex user behaviours. Finally, it’s easy to reuse scenarios for comparison and future testing.

5. Easy integration

Artillery.io seamlessly integrates with CI (for example, check the integration guide for GitHub Actions), making the process very organized. It also works with Docker, so you can run your Artillery tests inside a Docker container.

6. Detailed reports

After running tests, you can create a JSON report through the — output flag. Also, you can generate an HTML report out of JSON to save it as a file or export it to your browser. Find details on reporting in the Scenario section below.

7. Artillery Docs

Artillery provides numerous documents to browse for instructions and other useful info. This helps you get the performance testing software up and running much smoother than with other similar tools. Also, you can look up support from other developers on community forums.

How does Artillery.io work?

I’m going to walk you through some basic commands to get started with Artillery.io using ngx-bootstrap in my examples. Ngx-bootstrap, together with other community libraries, were created by Valor Software, the company where I’m working. And as we have hundreds of thousands of engineers using our products monthly, we need scalable performance testing to make sure everything runs smoothly. So, let’s get started!

Install

To install the latest version, enter:

Fast test

To run a fast test, enter:

Config

For standard test scenarios, you should create a ‘my.yml’ file with config.

Artillery configuration file my.yml
Artillery setup of test environments

Phases in the config

Artillery.io allows you to enter multiple sequential load options for the application. The testing phase consists of several aspects:

  • duration: the time of one phase;
  • arrivalRate: the number of users added each second;
  • rampTo: up to how many users per second the load will grow by;
  • name: a name of the phases.
Artillery config phases

Plugins

In the Artillery npm utility, you can find lots of plugins that can help you in your performance testing. Install artillery-plugin-expect to compare the expected result with the actually received result.

Artillery performance testing — plugins

Scenario

All tests should be written in the `scenarios` section and should contain:

  • GET, POST, PUT, DELETE, and some other commands;
  • a URL for every endpoint;
  • the body text in JSON format;
  • all checks you want to run.
writing tests in Artillery
Artillery load testing — report example

Authentication

With Artillery.io, you can use basic authentication or get authorized by tokens uploading CSV with your credentials. Just pick an option that suits your project best.

Artillery — authorisation
  • payload — to use the payload functionality;
  • path — to write a path for the CSV file that Artillery needs to use;
  • fields — names of fields that you need to use.
Artillery — upload CSV file to authorise by tokens
Artillery — CSV authentification
Artillery — authentication with environment variable
Artillery performance testing — package json
Artillery — past parameters for test requests

Final thoughts

Artillery.io is an accessible and comprehensive tool that I use and can surely recommend for performance testing.

  • runs millions of tests per second across 13 geographical regions;
  • works with existing security systems;
  • no repeat charges or paid maintenance;
  • VPC internal test services.

Useful Links

- Installation through npm utility guide
- Artillery docs
- Artillery plugins on npm

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Valor Software

Valor Software

21 Followers

Useful articles from experienced Valor specialists in various spheres of digital development.