1

How to spawn 5 browser instances parallely for 5 unittest testclasses each containing 4-5 testcases. I have grouped the classes into a testsuite and calling nose2 like below. But its launching the browser instances sequentially.

nose2 -s "test-suite directory" -t "top-level project directory" --config nose2.cfg

nose2.cfg

[unittest]
plugins = nose2.plugins.mp
[multiprocess]
processes = -1

Update-->

Instead of using default testsuite class , below code using multiprocessing does the job of spawning 3 local browser instances for 3 testclasses.

from multiprocessing import Pool

tc1="load tc1"
tc2="load tc2"
tc3="load tc3"

test_runner=HtmlTestRunner.HTMLTestRunner(output='reports_dir')

def run():
    p=Pool(processes=3)
    p.map(runner,[tc1,tc2,tc3])

def runner(tc):
    test_runner.run(tc)

if __name__ == '__main__':
    exit(run())
jMpi
  • 11
  • 4

0 Answers0