Mak*_*sim 4 testing automated-tests web-testing e2e-testing testcafe
是否可以在隔离模式下运行某些测试,而在不使用该模式的情况下运行其他测试?例如,我们有一些轻量级测试,我们不需要进行3次尝试,但对于其他测试则可能是必要的
您可以使用不同的过滤器串联运行两个testcafe赛跑者。其中之一可能是隔离模式。
例如:
const createTestCafe = require('testcafe');
let testcafe = null;
const runTests = (testFiles, quarantineMode, testPrefix) => {
const runner = testcafe.createRunner();
return runner
.src(testFiles)
.filter((testName) => testName.startsWith(testPrefix))
.browsers(['chrome'])
.run({ quarantineMode });
};
createTestCafe('localhost', 1337, 1338)
.then(tc => {
testcafe = tc;
return runTests(['test.js'], false, 'Simple')
.then(() => runTests(['test.js'], true, 'Complex'));
})
.then(() => testcafe.close());
Run Code Online (Sandbox Code Playgroud)
测试:
test('Simple Test', async t => {
//...
});
test('Complex Test', async t => {
//...
});
Run Code Online (Sandbox Code Playgroud)