New Modern Open Source Performance Testing Tool : Locust
If you are bored with using old fashioned Java GUI to test the performance of your applications, then you should try Locust. Jmeter, which is old fashioned as I mentioned, is very mature and used by a big community but you have create your test case with an ugly GUI as much features as allows you. For me the best part of Locust is that you can write your test case with Python which is my favourite language and it is very simple to learn. The installation is very simple, you just need to type:
> pip install locustio
Some feature / deficiency of Locust:
- You can write your test case in Python
- You can define the user time consumption on a page with min_wait and max_wait as milliseconds in locust class so that get a real user simulation.
- You can give weight for each test cases so you can simulate real user behaviours like during a specific period of time: 1 person signs up, 10 persons login, 60 persons visit pages, ...
- You can make http request as you do in your code such as get, post, put, delete, head, patch and options. So you can send request directly to your api, like:
- While Jmeter is thread based so it uses a separate thread to create a user but Locust id co-routine and work asynchronously as you see after running the number of user for each case. This means that you can create more user in Locust than in Jmeter.
- With the PyQuery library, you can query throughout your interface. For example you can find all the links in html and then send requests to respondent pages.
- There is some problem with single page application like if there is "#" in your url it behaves as there is no url.
- There is no graphic option but you can hack everything.
You can check the script below which is written for www.myhabit.com to run performance testing for the link on "/my-account" page. With the script, we are loging on the page and then we can open the my account page. The result may not be different when you want to test because it depends on many factors.
For more information about the Locust click here.