Distributed load testing with Artillery Pro
For more information, read the "Pipeline schedules" section in GitLab's documentation. When setting up a new schedule, you can specify the interval, which timezone you want to use, set the target branch, and include variables for your job. You can set a schedule for any available pipelines in your GitLab project by going to the CI/CD → Schedules section on your project and clicking on the New schedule button: For instance, you may wish to load-test your production applications outside of peak hours. You can also set up GitLab CI/CD to run a job on a recurring schedule by using the built-in Schedules section for your project, which is helpful if you want to execute your Artillery load tests at a specific time.
home/node/artillery/bin/artillery report -output reports/report reports/report.jsonĪfter successful execution of the load test, GitLab CI/CD will store a zip file of the directory created as part of the job, which you can download from the list of jobs for your project:įor more details on accessing the artifacts of a GitLab CI/CD job, read the "Download job artifacts" section in GitLab's documentation. home/node/artillery/bin/artillery run -output reports/report.json tests/performance/socket-io.yml The following configuration accomplishes these steps: Finally, you'll need to store the files as artifacts to access the reports upon completion of the job. You can then use the report command to generate the HTML report from the JSON file. Next, you can generate a JSON report when executing the Artillery load test.
Once you push the update to GitLab, a GitLab CI/CD runner will execute the load test: Generating and viewing Artillery test reports Īrtillery can output a JSON file with additional details from the load test and use it to generate a self-contained HTML report.įirst, the job needs to create a directory to place the test reports. GitLab CI/CD runners start any Docker containers using the defined ENTRYPOINT, which we don't need for continuous integration purposes.Ĭommit this file to the main branch of your repository. Note that the Docker image has its ENTRYPOINT overridden in the configuration file. Script : /home/node/artillery/bin/artillery run tests/performance/socket - io.yml gitlab-ci.yml with the following contents: When your project has available runners, create the GitLab CI/CD configuration file in. If your project does not have any available runners (for instance, if your organization self-hosts GitLab), you'll have to install GitLab Runner and register a runner before using GitLab CI/CD. To verify the available CI/CD runners for your project, go to the Settings → CI/CD section on your project and expand the Runners section. Most projects hosted on GitLab's SaaS offering have shared runners available. gitlab-ci.yml configuration file, you'll first need to ensure your GitLab project has runners available to execute your CI/CD jobs. We'll also use the official Docker image to execute the load test without setting up Artillery as part of the workflow.īefore creating the. The configuration files use YAML syntax to define the events that will trigger your workflow and the jobs and steps to execute.įor this guide, the Artillery load test for the Socket.IO service will run after pushing new code to the main branch of your existing GitLab repository. GitLab CI/CD looks for a configuration file placed inside your code repository called. You can run an example of this test script and see it in action.