【问题标题】:TFS Build VS Test Runner - Run only tests with no TestCategoryTFS Build VS Test Runner - 只运行没有 TestCategory 的测试
【发布时间】:2015-09-04 01:21:02
【问题描述】:

我目前在 30 多个项目上运行了大约 6000 多个测试。

其中一些测试只能在本地运行,所以已经用属性修饰了:

TestCategory="Manual Tests" 

这也适用于任何功能测试,这些都用:

TestCategory="Functional Tests" etc...

我已经阅读了许多关于此的 MSDN 和用户文章,并设置了一个构建以仅运行功能测试

Test Case Filter: TestCategory=Functional Tests 
(This successfully runs only the Functional Tests)

问题是,我是否可以使用一个测试用例过滤器来忽略 TestCategory“功能测试”和“手动测试”,而只运行没有使用 TestCategory 属性修饰的测试。

如果使用了以下过滤器没有任何乐趣:

**Test Case Filter:**

!Functional Tests|!Manual Tests
TestCategory!=Functional Tests|Manual Tests
TestCategory!=Functional Tests|!Manual Tests
TestCategory!=Functional Tests|TestCategory=Manual Tests
TestCategory!=Functional Tests||TestCategory=Manual Tests
(TestCategory!=Functional Tests)|(TestCategory=Manual Tests)
(TestCategory!=Functional Tests)||(TestCategory=Manual Tests)

我在带有 TFS 2012(更新 4)的 Visual Studio 2012(更新 4)上运行它

非常感谢

【问题讨论】:

    标签: visual-studio-2012 tfsbuild visual-studio-test-runner


    【解决方案1】:

    通过在过滤器周围使用“()”来解决此问题。还有 | is or, and & is and so 使用 x!=y 或 y!=z 将不起作用。使用 & 表示不等于评估。

    /TestCaseFilter:"(TestCategory!=PreTest&TestCategory!=PostTest&TestCategory!=CleanUp)"

    【讨论】:

    • 括号是它!这是我在 TFS 测试过滤器标准中输入的内容:(TestCategory!=Nightly&TestCategory!=Ignore)。我的目标是运行除上述类别之外的所有单元测试。基本上我想运行所有我没有分配类别的测试。
    【解决方案2】:

    从小处着手,然后建立..您是否尝试过一种说法,例如: TestCategory!='功能测试'

    查看文档,我对完整命令的第一次尝试是: TestCategory!='功能测试'&TestCategory!='手动测试'

    【讨论】:

    • 感谢您的回复。我有一个过滤器设置一个功能测试只构建TestCategory!=Functional Tests 并且它按预期工作,只有它运行所有具有 no category 的测试和具有 category = Manual Tests 的测试跨度>
    • 你试过了吗:TestCategory!='Functional Tests'&TestCategory!='Manual Tests'
    • 我使用过滤器 TestCategory!='Functional Tests'&TestCategory!='Manual Tests 运行了一个构建,但不幸的是,所有测试都运行,无论测试类别如何。它似乎忽略了过滤器默认为所有测试运行
    猜你喜欢
    • 1970-01-01
    • 2010-11-14
    • 2011-02-18
    • 2010-09-26
    • 1970-01-01
    • 2019-02-19
    • 2016-11-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多