Best Python code snippet using locust
test_runners.py
Source:test_runners.py  
...711            # Simulate that some workers are missing by "killing" them abrutly712            for i in range(3):713                workers[i].greenlet.kill(block=True)714            @retry(AssertionError, tries=10, delay=1)715            def check_master_worker_missing_count():716                self.assertEqual(3, len(master.clients.missing))717            # Check that master detected the missing workers718            check_master_worker_missing_count()719            @retry(AssertionError, tries=10, delay=1)720            def check_remaing_worker_new_user_count():721                for i in range(3, 6):722                    self.assertEqual(2, workers[i].user_count)723            # Check that remaining workers have a new count of user due to rebalancing.724            check_remaing_worker_new_user_count()725            sleep(1)726            # Finally quit and check states of remaining workers.727            master.quit()728            # make sure users are killed on remaining workers729            for i in range(3, 6):730                self.assertEqual(0, workers[i].user_count)731        # check that stats are present in master732        self.assertGreater(...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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
