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.

Parameters:
 --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, all-links-4.py 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 all-links-4.py --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:






Comments

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

    Software testing training

    ReplyDelete

Post a Comment

Popular posts from this blog

Selenium Error "Element is not currently interactable and may not be manipulated"

Change Default Timeout and Wait Time of Capybara

Selenium Chromedriver Error Message: u'unknown error: unable to discover open pages

Getting the text of elements in Espresso