Files
water-management-system/tests/performance/__pycache__/locustfile.cpython-312.pyc
T

29 lines
3.7 KiB
Plaintext
Raw Normal View History

Ë
ÀYzjãó2—dZddlmZmZmZGd„de«Zy)u›REST API 压测脚本(Issue #94)- Locust
覆盖完整用户路径:登录 -> 设备查询 -> 数�上报 -> 报表查询
并�梯度:locust -u 10/50/100/500/1000 --spawn-rate 10
�行:
pip install locust
locust -f tests/performance/locustfile.py --host http://127.0.0.1:8000 -u 100 --spawn-rate 10 --run-time 5m --headless --html reports/locust_$(date +%F_%H%M).html
é)ÚHttpUserÚbetweenÚtaskcóÄ—eZdZedd«ZdZd„Zed„«Ze d«d„«Z
e d«d „«Z e d
«d „«Z e d
«d „«Z
e d
«d„«Zy)ÚWaterManagementUsergà?g@Ncó—|jjddddœd¬«}|jdk(r6 |j«j di«j d «|_y
|j«y
#t $r
d
|_Yy
wxYw) uT登录获å�– token(若接å�£ä¸�存在则以匿å��继续,ä¿�è¯�压测å�¯è¿�行)z/api/auth/loginÚperfÚperf123)ÚusernameÚpasswordT)ÚjsonÚcatch_responseéÈÚdataÚ access_tokenN)ÚclientÚpostÚ status_coder
ÚgetÚtokenÚ ExceptionÚsuccess)ÚselfÚresps útests/performance/locustfile.pyÚon_startzWaterManagementUser.on_starts„€à�{‰{×ÑÐ 1Ø28ÀiÑ%PØ/3ð ó5ˆð × Ñ ˜sÒ "ð
"Ø!ŸY™Y›[Ÿ_™_¨V°RÓ8×<Ñ<¸^ÓL�•
ð
�L‰L�Nøôò
"Ø!�–
ð
"ús²4A8Á8B Â
B có@—|jrdd|j›�iSiS)NÚ
AuthorizationzBearer )r©rs rÚheaderszWaterManagementUser.headers!s#€à<@¿JºJ� 7¨4¯:©:¨,Ð!7Ð8ÐNÈBÐNóécóT—|jjd|jd¬«y)Nz /api/devices?page=1&page_size=20z /api/devices©r Úname©rrr rs rÚ list_devicesz WaterManagementUser.list_devices%s#€à � ‰ �‰Ð:ÀDÇLÁLØ+ð õ -r!écóT—|jjd|jd¬«y)Nz/api/devices/1z/api/devices/{id}r$r&rs rÚ