我正在使用TestCafe来运行集成测试.我知道它具有 test.skip 函数,该函数非常适合当我在本地进行测试并且想要跳过不需要/不想运行的一组测试...但是我当时想知道是否有一种方法可以运行除 -test-meta environmentSpecific = true 等以外的所有测试?
I'm using TestCafe to run my integration tests. I know it has the test.skip function, which is great for when I'm testing locally and want to skip a set of tests I don't need/want to run... but I was wondering if there was a way to run ALL TESTS except --test-meta environmentSpecific=true etc?
我们有许多不同的环境,我正在寻找一种简单的方法来通过CLI跳过测试,具体取决于我们针对构建的目标环境.
We have a number of different environments, and I'm looking for a simple way to skip tests via the CLI, depending on the environment we're targeting for the build.
推荐答案是的,您可以使用编程方式来运行TestCafe.查看示例:
Yes, you can do it using the programmatic way to run TestCafe. See an example:
const createTestCafe = require('testcafe'); let testcafe = null; createTestCafe('localhost', 1337, 1338) .then(tc => { testcafe = tc; const runner = testcafe.createRunner(); return runner .src('/tests') .filter((testName, fixtureName, fixturePath, testMeta, fixtureMeta) => { return !testMeta.environmentSpecific; }) .browsers(['chrome', 'safari']) .run(); }) .then(failedCount => { console.log('Tests failed: ' + failedCount); testcafe.close(); });另请参阅:指定测试元数据
更多推荐
是否可以使用TestCafe .meta对象跳过从cli运行的测试
发布评论