是否可以使用TestCafe .meta对象跳过从cli运行的测试

编程入门 行业动态 更新时间:2024-10-27 16:27:22
本文介绍了是否可以使用TestCafe .meta对象跳过从cli运行的测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用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运行的测试

本文发布于:2023-11-16 18:58:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1606957.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可以使用   跳过   对象   测试   TestCafe

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!