How to use test_rebalance_locust_users_on_worker_connect method in locust

Best Python code snippet using locust

test_runners.py

Source:test_runners.py Github

copy

Full Screen

...546 }, "fake_client"))547 self.assertEqual(30, master.stats.total.get_current_response_time_percentile(0.5))548 self.assertEqual(3000, master.stats.total.get_current_response_time_percentile(0.95))549 550 def test_rebalance_locust_users_on_worker_connect(self):551 with mock.patch("locust.rpc.rpc.Server", mocked_rpc()) as server:552 master = self.get_runner()553 server.mocked_send(Message("client_ready", None, "zeh_fake_client1"))554 self.assertEqual(1, len(master.clients))555 self.assertTrue("zeh_fake_client1" in master.clients, "Could not find fake client in master instance's clients dict")556 557 master.start(100, 20)558 self.assertEqual(1, len(server.outbox))559 client_id, msg = server.outbox.pop()560 self.assertEqual(100, msg.data["num_users"])561 self.assertEqual(20, msg.data["hatch_rate"])562 563 # let another worker connect564 server.mocked_send(Message("client_ready", None, "zeh_fake_client2"))...

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