Created
May 19, 2016 22:40
-
-
Save RobSpectre/4b0523effd299775686e2f3bb659fda3 to your computer and use it in GitHub Desktop.
Load Test Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from locust import HttpLocust, TaskSet, task | |
class UserBehavior(TaskSet): | |
@task(5) | |
def positive(self): | |
self.client.post("/sms", {"AddOns": '{"status":"successful","message":null,"code":null,"results":{"mobilecommons_optout":{"request_sid":"XR8b9aa36363d6f4ec4fe42dade911baa6","status":"successful","message":null,"code":null,"result":{"probability":0}},"ibm_watson_insights":{"request_sid":"XR2ad003f13c531200832776b7e1df7190","status":"failed","message":"Request timed out","code":61001,"result":{}},"ibm_watson_sentiment":{"request_sid":"XRb80b1d857cffed90098863f17d040f21","status":"successful","message":null,"code":null,"result":{"status":"OK","usage":"By accessing AlchemyAPI or using information generated by AlchemyAPI, you are agreeing to be bound by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html","totalTransactions":"1","language":"english","docSentiment":{"score":"0.629583","type":"positive"}}}}}'}) | |
@task(1) | |
def negative(self): | |
self.client.post("/sms", {"AddOns": '{"status":"successful","message":null,"code":null,"results":{"mobilecommons_optout":{"request_sid":"XR6ffe4412887f76f4aaf03fb4d3b976e5","status":"successful","message":null,"code":null,"result":{"probability":0}},"ibm_watson_insights":{"request_sid":"XRd06cf9d6bab5c23036b0af56c2a479f1","status":"successful","message":null,"code":null,"result":{"status":"OK","usage":"By accessing AlchemyAPI or using information generated by AlchemyAPI, you are agreeing to be bound by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html","totalTransactions":"5","language":"english","keywords":[],"concepts":[],"entities":[]}},"ibm_watson_sentiment":{"request_sid":"XRbe8eecfb5b0fa456fd40030263835598","status":"successful","message":null,"code":null,"result":{"status":"OK","usage":"By accessing AlchemyAPI or using information generated by AlchemyAPI, you are agreeing to be bound by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html","totalTransactions":"1","language":"english","docSentiment":{"score":"-0.845207","type":"negative"}}}}}'}) | |
class WebsiteUser(HttpLocust): | |
task_set = UserBehavior | |
min_wait=5000 | |
max_wait=9000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment