Testing 夹具或测试的隔离模式
是否可以在隔离模式下运行某些测试,而在没有隔离模式的情况下运行其他测试?Testing 夹具或测试的隔离模式,testing,automated-tests,e2e-testing,web-testing,testcafe,Testing,Automated Tests,E2e Testing,Web Testing,Testcafe,是否可以在隔离模式下运行某些测试,而在没有隔离模式的情况下运行其他测试? 例如,我们有一些轻量级测试,不需要尝试3次,但对于其他测试,这是必要的您可以以不同的方式运行两个testcafe运行程序。其中一个可能处于隔离模式 例如: const createTestCafe = require('testcafe'); let testcafe = null; const runTests = (testFiles, quarantineMode, testPrefix) => {
例如,我们有一些轻量级测试,不需要尝试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());
测试:
test('Simple Test', async t => {
//...
});
test('Complex Test', async t => {
//...
});