Add Locust test template

Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
This commit is contained in:
Drasko DRASKOVIC 2016-05-18 20:41:21 +02:00
parent f92db09290
commit fb4140d69c
2 changed files with 35 additions and 0 deletions

16
test/locust/README.md Normal file
View File

@ -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

View File

@ -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