【问题标题】:Using tags ( Smoke, regression) with TestCafe在 TestCafe 中使用标签(Smoke、regression)
【发布时间】:2018-10-24 06:17:43
【问题描述】:

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

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

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

【问题讨论】:

    标签: testing e2e-testing testcafe regression-testing smoke-testing


    【解决方案1】:

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

    【讨论】:

    • 酷!感谢您推荐好的做法!我将使用元数据实现它并等待公关通过!!!我希望它尽快推出
    【解决方案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

    【讨论】:

      猜你喜欢
      • 2012-06-09
      • 2020-03-18
      • 2019-08-10
      • 1970-01-01
      • 1970-01-01
      • 2018-04-28
      • 2022-06-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多