Skip to main content

Artillery integration

Artillery is an amazing Load testing tool with an GREAT Developer Experience.

info

RestQA is not running performance test. RestQA is generating Artillery test scenario based on your functional tests

Pre-requisite

  • 1 minute ๐Ÿš€
  • Artillery installed
  • Valid RestQA configuration file
  • Valid Test scenario

Configuration

version: 0.0.1
metadata:
  code: EXAMPLE
  name: Example app
  description: This is the example app description
environments:
  - name: local
    default: true
    plugins:
      - name: restqapi
        config:
          url: https://api.restqa.io
          performance:
            tool: artillery 
    outputs:
      - type: html
        enabled: true

Options

Additional options are availble, check the introduction page

Scenario

In order to select a scenario to be run through Artillery, just add the tag @performance on top of it:

Example:

@performance
Scenario Outline: The product doesn't exist into the database
Given I have the api gateway
  And I have the path "/api/products/111112222233333"
  And I have the method "GET"
  And the header contains "accept-language" as "<language>"
  And the header contains "content-type" as "application/json"
When I run the API
Then I should receive a response with the status 404
  And the response body at "message" should equal "<message>"
  And the response time is under 1000 ms
Examples:
| language | message                    |
| en       | The product doesn't exist. |
| fr       | Le produit n'existe pas.   |
| it       | Le produit n'existe pas.   |
| default  | Le produit n'existe pas.   |

Generate the load test scenario:

The Artillery scenario will be generated every time you run the RestQA tests:

restqa run

Run your performance tests

RestQA will only generate the Artillery Scenario, it will not create the configuration for you, we are recommending that you store the configuration into a file.

Example:

config:
  target: "https://example.com"
  phases:
    - duration: 10
      arrivalRate: 1

Then run your artillery command:

artillery -c tests/performance/config.yml tests/performance/

And Voila!

Now it's opening the door to get your start performance testing step into your continuous integration flow withing a few minutes.

Example

asciicast