gpt4 book ai didi

visual-studio - 多个类别不适用于 MSTEST 命令行

转载 作者:行者123 更新时间:2023-12-04 05:52:41 25 4
gpt4 key购买 nike

我正在尝试使用 MSTEST 来运行 visual studio 测试,但是当我尝试使用/category:"&"时,测试不会运行,它会说它无法识别类别。

我想一次运行多个类别而不使用不同的 MSTEST 调用,以便在一个 MSTEST 调用中我可以运行所有类别并发布一个输出结果文件。

我的类别是正确的,因为它在 1 个类别中成功运行,我只是在附加它们时遇到了问题。

例如,

mstest  /testcontainer:.(...).dll  /testcontainer:.(...).dll /category:"Defect Tests&Functional Tests"

返回

Loading .\(...).testrunconfig
Loading .\(...).dll
Loading .\(...).dll
Starting execution...
No tests to execute.

但是,如果我只使用一个类别,请说:

\category:"Defect Tests"

它会很好地工作。

最佳答案

我没有意识到我应该使用 |作为文字或逻辑运算符,而不是其他东西。我正在使用 & 并且最终没有运行任何测试,因为我认为它会运行两个测试套件,但实际上,它只运行带有两个类别标签的测试......它们都不是。

例如(基于 https://msdn.microsoft.com/en-us/library/ms182489.aspx#category ):

/category:"group1|group2" runs tests that are in test category "group1" or "group2". 
Tests that are in both categories will also be run.

/category:!group1&!group2 exclude tests with categories "group1" and "group2".

/category:group1 runs tests in the test category "group1".

/category:"group1&group2" runs tests that are in both test categories "group1" and "group2." Tests that are only in one of the specified test categories will not be run.


/category:"group1&!group2" runs tests from the test category "group1" that are not in the test category "group2." A test that is in both test category "group1" and "group2" will not be run.

关于visual-studio - 多个类别不适用于 MSTEST 命令行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32775994/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com