Python 3.6 Performance Testing Framework Locust installation and use, pythonlocust
Background
Build and use of Python3.6 Performance Testing Framework Locust
Basic
Python version: python3.6
Development Tool: pycharm
Installation and configuration of Locust
Click "File"> "setting"
Click "setting" to enter the settings window. Select "Project Interpreter"
Click "+"
Enter "Locust" and click "Install Package"
After the installation is complete, you can use it.
After installing the Locust tool, you only need to write a simple Python file to test the system load. The following is an example:
1 from locust import Locust, TaskSet, task 2 3 class UserBehavior(TaskSet): 4 @task 5 def job(self): 6 pass 7 8 class User(Locust): 9 task_set = UserBehavior10 min_wait = 100011 max_wait = 3000
Enter the following information on the terminal:
1 mars@mars-Ideapad-V460:~/test$ locust2 [2015-09-12 10:46:36,876] mars-Ideapad-V460/INFO/locust.main: Starting web monitor at *:80893 [2015-09-12 10:46:36,919] mars-Ideapad-V460/INFO/locust.main: Starting Locust 0.7.3
Access localhost: 8089 in the browser. The following page is displayed:
First lineNumber of users to simulate
Is the number of simulated users, the second lineHatch rate (users spawned/second
It indicates the speed at which the simulated user is generated. After all users generate the simulated user, Start the test statistics. after entering the information, click "Start swarming" to Start the test: