How to use _create_runner method in locust

Best Python code snippet using locust

test_run_anything.py

Source:test_run_anything.py Github

copy

Full Screen

...22 self.output.append(output)23 self.finished = finished24class TestRunAnything(unittest.TestCase):25 def test_run(self):26 self.runner = self._create_runner('python %s count_args a b c' % SCRIPT)27 self._wait_until_finished()28 assert_true(self.runner.finished)29 assert_equal(self.runner.outstr, '3\n')30 if sys.version_info[:2] >= (2,6):31 def test_stopping(self):32 self.runner = self._create_runner('python %s output 0.8' % SCRIPT)33 time.sleep(0.3)34 self.runner.stop()35 self._sleep_and_log_output(0.1)36 assert_true(self.runner.finished)37 assert_true(self.runner.outstr.startswith('start\nrunning '))38 def test_error(self):39 self.runner = self._create_runner('invalid command')40 self._wait_until_finished()41 assert_true(self.runner.finished)42 assert_true(self.runner.outstr)43 def test_stderr(self):44 self.runner = self._create_runner('python %s stderr' % SCRIPT)45 self._wait_until_finished()46 assert_true(self.runner.finished)47 assert_equal(self.runner.outstr, 'This is stderr\n')48 def _create_runner(self, cmd):49 runner = _TestableRunner(RunConfig('test', cmd, ''), None)50 runner.run()51 return runner52 def _wait_until_finished(self):53 self.runner._process.wait()54 self.runner.OnTimer()55 def _sleep_and_log_output(self, amount):56 time.sleep(amount)...

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