[英]How can I run same test concurrently in testcafe to create a race condition?
我正在尝试创建一个竞争条件,其中相同的测试将同时运行
如果使用testcafe
命令运行测试,可以使用--concurrency
选项。 如果您使用runner
,您可以使用同名方法设置并发,或者只创建几个runner
对象并使用Promise.race
run
它们:
const createTestCafe = require('testcafe');
async function runTest(testcafe, src) {
const runner = testcafe.createRunner();
const failed = await runner
.src(src)
.browsers('chrome')
.run();
console.log('Tests failed: ' + failed);
}
(async function () {
const testcafe = await createTestCafe('localhost', 1337, 1338);
try {
await Promise.race([
runTest(testcafe, './test1.js'),
runTest(testcafe, './test2.js'),
runTest(testcafe, './test3.js'),
])
}
finally {
await testcafe.close();
}
})()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.