The students familiar with the Apache AB tool know that it is not interface-executed through the command line. Locust also provides the command line to run, the benefit is to save the client resources more.
Command line run Locust test
In the above section of the Baidu Home page test (load_test.py) as an example to run the test through No-web mode.
> Locust-F load_test.py--host=https://www.baidu.com--no-web-c 10-r 2-t 1m[2017-10-30 22:17:30,292] DESKTOP-SMGQBBM/INFO/locu St.main:Run timeLimitSet to seconds[2017-10-30 22:17:30,302] desktop-smgqbbm/info/locust.main:starting Locust 0.8[2017-10-30 22:17:30,302] desktop-smgqbbm/info/locust.runners:hatching and swarming clients at the rate 2 clients/s ... Name# reqs # fails AVG Min Max | Median req/s .... [2017-10-30 22:18:30,301] Desktop-smgqbbm/info/locust.main:timeLimit reached. Stopping Locust. [2017-10-30 22:18:30,302] Desktop-smgqbbm/info/locust.main:shutting Down (Exit code 0), bye. Name# reqs # fails AVG Min Max | Median req/s--------------------------------------------------------------------------------------------------- -----------------------------------------get/117 0 (0%) 31 17 96 | 2.10-------------------------------------------------------------------------------------------------------- ------------------------------------Total 117 0 (0%) 2.10 Percentage of the requests completed within given times Name # reqs 50% 66% 75% 80% 90% 95% 98% 99% 100%---- --------------------------------------------------------------------------------------------------------------- -------------------------get/117------------------------------------------------------------- ---------------------------------------------------------------------------------Total 117-96
Startup parameters:
–no-web indicates that tests are not run using the Web interface.
-C Sets the number of virtual users.
-R Sets the number of virtual users to start per second.
-T settings set the run time.
(iv) Locust No-web model