将标签(烟雾,回归)与TestCafe一起使用



使用 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" 

上面的代码片段会为我触发仅烟雾测试,但报告将显示测试名称以及这些标签

是否有处理标记的替代方法或不在测试执行报告中显示标记的解决方案?

它出现在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

我认为在这种情况下最好的解决方案是使用测试/夹具元数据。请参考以下文章:http://devexpress.github.io/testcafe/documentation/test-api/test-code-structure.html#specifying-testing-metadata 目前,您无法按元数据进行筛选,但此功能位于拉取请求中:https://github.com/DevExpress/testcafe/pull/2841。因此,合并此 PR 后,您将能够将任何元数据添加到测试中,并在命令行中按此元数据进行筛选。

最新更新