How to use test_stop_timeout_with_ramp_down method in locust

Best Python code snippet using locust

test_runners.py

Source:test_runners.py Github

copy

Full Screen

...1454 runner.start(user_count=3, spawn_rate=3, wait=False)1455 self.assertEqual(0, test_stop_run[0])1456 runner.stop()1457 self.assertEqual(2, test_stop_run[0])1458 def test_stop_timeout_with_ramp_down(self):1459 class MyTaskSet(TaskSet):1460 @task1461 def my_task(self):1462 gevent.sleep(1)1463 class MyTestUser(User):1464 tasks = [MyTaskSet]1465 environment = Environment(user_classes=[MyTestUser], stop_timeout=2)1466 runner = environment.create_local_runner()1467 # Start load test, wait for users to start, then trigger ramp down1468 runner.start(10, 10, wait=False)1469 sleep(1)1470 runner.start(2, 4, wait=False)1471 # Wait a moment and then ensure the user count has started to drop but1472 # not immediately to user_count...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run locust automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful