在 TestCafe 中使用标签(烟雾、回归)

Kis*_*uri 5 testing smoke-testing regression-testing e2e-testing 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" 
Run Code Online (Sandbox Code Playgroud)

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

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

Ale*_*aev 2

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