testing - 夹具或测试的隔离模式

标签 testing automated-tests e2e-testing web-testing testcafe

是否可以在隔离模式下运行一些测试并在没有模式的情况下运行其他测试? 例如,我们有一些轻量级测试,我们不需要对它们进行 3 次尝试,但对于其他测试可能是必要的

最佳答案

您可以使用不同的 filters 串联运行两个 testcafe runner .其中之一可能是隔离模式。

例如:

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 => {
    //...
});

关于testing - 夹具或测试的隔离模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57288071/

相关文章:

java - AppEngine 开发服务器的数据查看器

ruby-on-rails - RSpec:如何测试从 Controller 调用私有(private)辅助方法的辅助方法?

user-interface - 测试自动化中的 GUI 映射策略

java - Maven 没有运行 cucumber 测试

automated-tests - 模拟 API 根据请求 URL 的动态部分给出响应

e2e-testing - TestCafe页面初始化前如何设置本地存储

javascript - 如何重用现有 Cypress 测试中的函数,并在新测试中调用它?

unit-testing - 自动化性能测试

testing - <adlcp :map> in scorm 2004 4th edition

python-3.x - python : How can I press arrow keys randomly selenium