際際滷

際際滷Share a Scribd company logo
Prashanth Sams
Loading....
16th Jun 2021
Locust Basics
Part 1:
Basic Locust
Sscript
Part 2:
Host attribute |
HttpUser Class
Part 3:
wait_time
- between
- constant
- constant_pacing
Part 4:
Multiple User class
Weightage Attribute
Part 5:
Headless mode
02
Part 6:
Hooks
- on_start()
- on_stop()
Part 7:
Event Listener
- @events.test_start.add_listener
- @events.test_stop.add_listener
Prashanth Sams
Tasks
Part 1:
Task weightage
- @task(2)
Part 2:
Task attribute
tasks = [a, b]
Task Weightage
tasks ={a:2, b:1}
Part 3:
@task inside TaskSet
Part 4:
SequentialTaskSet
Part 5:
Nested TaskSet
- SequentialTaskSet
- Task Weightage
- self.interrupt()
03
Prashanth Sams
Http Requests
Part 1:
GET Request
- self.client.get('/', name='A')
Part 2:
POST Request
- self.client.post('/', data='',
headers='', name='',
catch_response=True)
Part 3:
- response.success()
- response.failure(exc='')
Part 4:
Cookies
- .cookies['']
- self.client.cookies.clear()
Part 5:
@tag('')
04
Prashanth Sams
Distribution
Part 1:
--master
--worker
Part 2:
--master --expect-worker 2
Part 3:
--config=master.yml
locustfile, host, master,
users, headless, spawn-rate
--config=slave.yml
locustfile, host, worker
05
Prashanth Sams
Part 4:
- Docker containerization
- Scaling workers
Reference:
https://locust.io/
https://github.com/prashanth-sams/locust-
boilerplate
Twitter Handle @prashanthsams
THANK YOU

More Related Content

Load Testing in Python with Locust from Zero