Testing 在testcafe中为其他几位跑步者提供大师级跑步者?

Testing 在testcafe中为其他几位跑步者提供大师级跑步者?,testing,automated-tests,e2e-testing,testcafe,web-testing,Testing,Automated Tests,E2e Testing,Testcafe,Web Testing,我有几个跑步者正在使用promise.race在特定时间完成测试用例 假设我有runner1.js、runner2.js和runner3.js,我如何创建一个主跑步者,以便我可以一起跑所有这些跑步者 const createTestCafe = require('testcafe'); let testcafe = null; // createTestCafe('localhost', 1337, 1338) createTestCafe() .then(tc => {

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

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允许同时运行多个测试运行程序。检查以下代码:

const createTestCafe=require('testcafe');
(异步()=>{
const testCafe=wait createTestCafe();
const runner1=testCafe
.createRunner()
.src('test1.js')
.reporter([{name:'spec',output:'report1.txt'}])
.浏览器(“chrome”);
const runner2=testCafe
.createRunner()
.src('test2.js')
.reporter([{name:'spec',output:'report2.txt'}])
.浏览器(“firefox”);
等待承诺.all([runner1,runner2].map(runner=>runner.run());
等待testCafe.close();
})();

TestCafe允许同时运行多个测试运行程序。检查以下代码:

const createTestCafe=require('testcafe');
(异步()=>{
const testCafe=wait createTestCafe();
const runner1=testCafe
.createRunner()
.src('test1.js')
.reporter([{name:'spec',output:'report1.txt'}])
.浏览器(“chrome”);
const runner2=testCafe
.createRunner()
.src('test2.js')
.reporter([{name:'spec',output:'report2.txt'}])
.浏览器(“firefox”);
等待承诺.all([runner1,runner2].map(runner=>runner.run());
等待testCafe.close();
})();

@Belym谢谢你!我理解这个概念,但当我尝试代码时,你说它不起作用,你能告诉我testcafe中的任何文档有这个,你知道为什么要使用map吗?我们也可以使用Promise.all()。然后?@TS0306我检查了Andrey的代码,它按预期工作。我们的文档中没有这种情况,但我确认允许同时使用多个运行程序。此处不需要使用
map
方法。您可以使用以下代码:
wait Promise.all([runner1.run(),runner2.run()])
。主要思想是
runner.run
方法返回一个promise,因此您可以轻松地在
promise.all()
方法中使用它。@Belym谢谢!我理解这个概念,但当我尝试代码时,你说它不起作用,你能告诉我testcafe中的任何文档有这个,你知道为什么要使用map吗?我们也可以使用Promise.all()。然后?@TS0306我检查了Andrey的代码,它按预期工作。我们的文档中没有这种情况,但我确认允许同时使用多个运行程序。此处不需要使用
map
方法。您可以使用以下代码:
wait Promise.all([runner1.run(),runner2.run()])
。主要思想是
runner.run
方法返回一个promise,因此您可以在
promise.all()方法中轻松使用它。