其他几个跑步者的 testcafe 中的主跑步者? [英] master runner in testcafe for several other runners?

查看:18
本文介绍了其他几个跑步者的 testcafe 中的主跑步者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个跑步者正在使用 promise.race 在特定时间完成测试用例假设我有 runner1.js、runner2.js runner3.js,我如何创建一个主 runner 以便我可以一起运行所有这些 runner?

I have several runners which are using promise.race to complete the testcase at a particular time Say I have runner1.js, runner2.js runner3.js, how do I create a master runner so that I can run all these runners together?

const createTestCafe = require('testcafe');
let testcafe = null;

// createTestCafe('localhost', 1337, 1338)
createTestCafe()
    .then(tc => {
        testcafe     = tc;
         //create test runner for configuring and launching test tasks
        const runner = testcafe.createRunner();



    return runner
        //run test from specified folders/files
        .src(['*the path to all runner.js*'])
        //configure the test runner to run tests in the specified browsers
        .browsers('chrome')
        .reporter('html-testrail')
        .run({skipJsErrors:true})             




    })


           .catch(failedCount => {
               console.log('Tests failed: ' + failedCount);
                testcafe.close();
            })

it's not working this way, any suggestions?

推荐答案

TestCafe 允许同时运行多个测试运行器.检查以下代码:

TestCafe allows running multiple test runners at the same time. Check the following code:

const createTestCafe = require('testcafe');

(async () => {
    const testCafe = await createTestCafe();

    const runner1 = testCafe
        .createRunner()
        .src('test1.js')
        .reporter([{ name: 'spec', output: 'report1.txt' }])
        .browsers('chrome');

    const runner2 = testCafe
        .createRunner()
        .src('test2.js')
        .reporter([{ name: 'spec', output: 'report2.txt' }])
        .browsers('firefox');

    await Promise.all([runner1, runner2].map(runner => runner.run()));

    await testCafe.close();
})();

这篇关于其他几个跑步者的 testcafe 中的主跑步者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆