Redeem Now
Read More
Read now
Menu Close
    Start a Project Request quote Reading list Switch to dark mode

    Artillery-ways to execute Script

    Till now we have read about the artillery and the HTTP load testing in artillery. There are many ways to execute artillery scripts, a quick test, a simple run or run with some over-rides. Lets see some different ways to execute artillery script :

    Run a quick test

    Artillery allows users to run custom test scripts written in either yaml or json, users can also perform a quick test without loading external scripts. The following command specifies 20 GET requests to be sent every second for 10 seconds creating 10 virtual users per request.
    artillery quick –count 10 -n 20 https://your-local-site-to-be.tested

    Run a simple test

    The following yaml file can be executed to achieve a simple run bu using artillery run your.yaml

    This command run the yaml file and sets a load of 10 users for 10 seconds to the given target. The duration and user count can be changed by changing the values  of “duration” and “arrivalRate” respectively.

    Test with output

    We can run the artillery test stating the output of result in a file. The output of test always returns a json file, the path of the file should be with in retailed to the path of yaml file. The following command run artillery test with output file named as “report.json” and the path of file is given relative to the path of test script.

    artillery run -o ‘report.json’ test.yaml

    This command will give the test output and will generate a report with name ‘report.json’. The outpot will be something like :

    Test with overrides

    In many situations it would be useful to adjust some of the values in the config section. To achieve the same, we can use -overrides in artillery.This option is used to override parts of the test script, for example, we need to override the phase definitions in the test script. We can use:

    artillery run –overrides ‘{“config”: {“phases”: [{“duration”: 10, “arrivalRate”: 1}]}}’ test. yaml


    Here in the test script, the duration and the arrivalRate are set to 100. When we run the above commad in the command line, the duration and arrivalRate are overridden by 10 and 1 respectively.

    Test with passing Variables

    In case if we need to set some variable or need to override the given variables in artillery, we can achieve it by using
    artillery run -v ‘{“size”: [“small”, “medium”, “large”], “color”:[“black”, “blue”]}’ test.yaml
    Makes variables “size” and “color” available in scenarios, with values picked from the respective lists. If the variables are present in the yaml file, they will be overridden by the provided variables. This overriding of variables could be done to test new values to the data.

    Test with reports

    We now have an output of data in json format for the test run via artillery.So we must convert it into the html format in order to see it in the browser. Artillery also provides a retort generation in a GUI format. So, below is the command to convert above generated report to html
    artillery run -o report.json mytest.yaml
    artillery report report.json

    The command -o <report_name> will generate the report after completion of the test.This report will be generated in json file and could be generated to html file.

    The above were the different ways to run artillery scripts.

    Suggestion are appreciated in the comments 😀

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


  • Madan J
    Please help me for this task.
    Create ramp up arrival rate from 10 to 20 over 1 minute to create the user account. Define the variable request URL, name, and job in the Inline variable. Search the newly created user using ID. Use Reqres application as base and request URL.
    Need script for the above one
    • Gautam Bagchi (Moderator)
      Hi, Please connect with concern forum, the community member will assist you in the best possible way.
  • Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again

    Table of Content

    Hide Index