使用nose2unitest/python/testsuite并行执行testsuite测试用例

问题描述

如何为 5 个单元测试测试类并行生成 5 个浏览器实例,每个测试类包含 4-5 个测试用例。我将这些类分组到一个测试套件中,并像下面这样调用nose2。但它按顺序启动浏览器实例。

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

nose2.cfg

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

更新-->

不是使用认的测试套件类,下面使用多处理的代码可以为 3 个测试类生成 3 个本地浏览器实例。

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())

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)