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

Multiple Categories not working with MSTEST command-line

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

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

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

例如,

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

returns

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

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

\category:"Defect Tests"

完全没问题。

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

例如(基于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.