How to use run_specific_workers_and_tests_num method in Slash

Best Python code snippet using slash

test_parallel.py

Source:test_parallel.py Github

copy

Full Screen

...20 def cleanup(): # pylint: disable=unused-variable21 os.rmdir(tmpdir)22 del os.environ["SLASH_USER_SETTINGS"]23#basic features of parallel24def run_specific_workers_and_tests_num(workers_num, tests_num=10):25 suite = Suite(debug_info=False, is_parallel=True)26 suite.populate(num_tests=tests_num)27 summary = suite.run(num_workers=workers_num)28 assert len(summary.session.parallel_manager.server.worker_session_ids) == workers_num29 assert summary.session.results.get_num_successful() == tests_num30 assert summary.session.results.is_success()31 return summary32def test_one_worker():33 run_specific_workers_and_tests_num(workers_num=1)34def test_many_workers():35 run_specific_workers_and_tests_num(workers_num=3, tests_num=50)36def test_zero_workers(parallel_suite):37 summary = parallel_suite.run(num_workers=0) #should act like regular run of slash, not parallel38 assert summary.session.results.is_success()39 assert summary.session.parallel_manager is None40def test_test_causes_worker_exit(parallel_suite, config_override):41 config_override("parallel.communication_timeout_secs", 2)42 parallel_suite[0].append_line("import os")43 parallel_suite[0].append_line("os._exit(0)")44 parallel_suite[0].expect_interruption()45 workers_num = 146 summary = parallel_suite.run(num_workers=workers_num, verify=False)47 assert len(summary.session.parallel_manager.server.worker_session_ids) == workers_num48 [result] = summary.get_all_results_for_test(parallel_suite[0])49 assert result.is_interrupted()...

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 Slash 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