Performance Testing on CI: Locust is running on Jenkins

For a successful Continuous Integration pipeline, there should be jobs for testing the performance of the application. It is necessary if the application is still performing well. Generally performance testing is thought as kinds of activities performed one step before going to live. In general approach it is true but don't forget to test your application's performance as soon as there is an testable software, such as an api end point, functions, and etc. For CI it is a good approach to testing performance after functional testing and just before the deployment of next stage. In this post, I want to share some info about Jenkins and Locust.

In my previous post you can find some information about Locust and Jenkins. Jenkins operates the CI environment and Locust is a tool for performance testing. To run the Locust on Jenkins you need command line arguments which control the number of clients,  hatch rate, running locust without web interface and there should be some parameters to stop the Locust automatically.

 --clients      : number of users / concurrent user
 --hatch-rate   : number of users will join the system (users per second)
 --num-reques   :  number of request in total
 --no-web       : tell that test will perform on command line
 --only-summary :  only show the result

For the full list of the parameters, see this For stopping the test, you can also use stop_timeout variable in your Locust class. For the examples beow, it will stop after 20 seconds. This should be set because CI means feedback shorter and quickier if there is anything wrong in the system. If you have problem with sending request, waiting the --num-reques may take to much time.
class User(HttpLocust): 
    task_set = UserBehaviour 
    stop_timeout = 20 

Full script for testing Myhabit's my account page:

With the following command, will be run with 20 clients, every second 1 client is hatched and it continues until the total request number is 100.

/usr/local/bin/locust -f --clients=20 --hatch-rate=1 --num-request=100 --no-web

Same as in the web part of Locust, you can see the result from Jenkins console output as success and failure respectively:


  1. Software testing industry offer huge career opportunity for talented professionals.

    Software testing training


Post a Comment

Popular posts from this blog

Testing WEB Sevices and Automating SOAP Services

Change Default Timeout and Wait Time of Capybara

Performance Testing on CI: Integration of Locust and Jenkins

Create an Alias for Interactive Console Work: Selenium and Capybara