简体   繁体   中英

Quarantine mode for the fixture or test

Is it possible to run some tests in quarantine mode and run others without the mode? For example, we have some lightweight tests and we don't need 3 tries for them, but for others it can be necessary

You can run two testcafe runners in series with different filters . One of them may be with the quarantine mode.

For example:

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());

tests:

test('Simple Test', async t => {
    //...
});

test('Complex Test', async t => {
    //...
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM