Add Locust test template
Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
This commit is contained in:
parent
f92db09290
commit
fb4140d69c
|
@ -0,0 +1,16 @@
|
||||||
|
## Locust Performance Testing
|
||||||
|
Locust website: http://locust.io/
|
||||||
|
|
||||||
|
Locust is an easy-to-use, distributed, user load testing tool.
|
||||||
|
Intended for load testing web sites (or other systems) and figuring out how many
|
||||||
|
concurrent users a system can handle.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
```bash
|
||||||
|
locust -f locustfile.py --host=http://localhost:1026
|
||||||
|
```
|
||||||
|
|
||||||
|
Open the browser at localhost:8089 and start the swarm.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
http://docs.locust.io/en/latest/index.html
|
|
@ -0,0 +1,19 @@
|
||||||
|
from locust import HttpLocust, TaskSet, task, ResponseError
|
||||||
|
|
||||||
|
class CheckStatus(TaskSet):
|
||||||
|
def on_start(self):
|
||||||
|
""" on_start is called when a Locust start before any task is scheduled """
|
||||||
|
print("Locus test started")
|
||||||
|
|
||||||
|
@task(1)
|
||||||
|
def getVersion(self):
|
||||||
|
headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}
|
||||||
|
response = self.client.get("/version", headers=headers)
|
||||||
|
|
||||||
|
print "Response status code:", response.status_code
|
||||||
|
print "Response content:", response.content
|
||||||
|
|
||||||
|
class HelloLocust(HttpLocust):
|
||||||
|
task_set = CheckStatus
|
||||||
|
min_wait=5000
|
||||||
|
max_wait=9000
|
Loading…
Reference in New Issue