使用testcafe grep模式可以部分解决我们使用标签的问题,但它仍会在规范报告中显示这些标签...... !!!
有没有办法在测试/夹具名称中包含标签并使用grep模式但是跳过那些标签才能在执行报告中显示?
import { Selector } from 'testcafe';
fixture `Getting Started`
.page `http://devexpress.github.io/testcafe/example`;
test('My first test --tags {smoke, regression}', async t => {
// Test code
});
test('My Second test --tags {smoke}', async t => {
// Test code
});
test('My first test --tags {regression}', async t => {
// Test code
});
testcafe chrome test.js -F "smoke"
虽然上面的代码片段会触发烟雾测试,但报告会显示测试名称以及这些标签
是否有替代方法来处理标签或解决方案,以便不在测试执行报告中显示标签?
我认为在这种情况下最好的解决方案是使用测试/夹具元数据。请参考以下文章:http://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#specifying-testing-metadata目前,您无法按元数据进行过滤,但此功能位于拉取请求中:https://github.com/DevExpress/testcafe/pull/2841。因此,在合并此PR之后,您将能够在命令行中通过此元数据添加任何元数据以进行测试和筛选。
它出现在testcafe的最新版本(v0.23.1)中,您现在可以通过命令行过滤元数据。
您现在只能运行其元数据包含一组特定值的测试或灯具。使用--test-meta和--fixture-meta标志来指定这些值。
testcafe chrome my-tests --test-meta device=mobile,env=production
要么
testcafe chrome my-tests --fixture-meta subsystem=payments,type=regression
在https://devexpress.github.io/testcafe/blog/testcafe-v0-23-1-released.html了解更多信息