How to use test_distribute_users method in locust

Best Python code snippet using locust

test_dispatch.py

Source:test_dispatch.py Github

copy

Full Screen

...1780 User48,1781 User49,1782 User50,1783 ]1784 def test_distribute_users(self):1785 workers = [WorkerNode(str(i)) for i in range(10_000)]1786 target_user_count = 1_000_0001787 users_dispatcher = UsersDispatcher(worker_nodes=workers, user_classes=self.user_classes)1788 ts = time.perf_counter()1789 users_on_workers, user_gen, worker_gen, active_users = users_dispatcher._distribute_users(1790 target_user_count=target_user_count1791 )1792 delta = time.perf_counter() - ts1793 # Because tests are run with coverage, the code will be slower.1794 # We set the pass criterion to 5000ms, but in real life, the1795 # `_distribute_users` method runs faster than this.1796 self.assertLessEqual(1000 * delta, 5000)1797 self.assertEqual(_user_count(users_on_workers), target_user_count)1798 def test_ramp_up_from_0_to_100_000_users_with_50_user_classes_and_1000_workers_and_5000_spawn_rate(self):...

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