4

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

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

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

4

2 回答 2

2

它出现在最近发布的 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

于 2019-04-10T11:57:55.273 回答
2

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

于 2018-10-24T08:55:20.200 回答