根据official TestCase documentation ,您可以在 TestCase 过滤器中使用“不包含”(!~) 过滤器。
我正在尝试在 Azure Devops 管道中使用此过滤器,但根据运行该管道时出现的错误,该过滤器不受支持:
##[error]Incorrect format for TestCaseFilter Error: Invalid Condition 'FullyQualifiedName!~DSN'. Specify the correct format and try again. Note that the incorrect format can lead to no test getting executed.
This functionality was added in a 16.0 preview version .管道使用 VSTest 16.6.1,如输出中的这些行所示:
C:\agent\_work\_tool\VsTest\16.6.1\x64\tools\net451\Common7\IDE\Extensions\TestPlatform\vstest.console.exe "@C:\agent\_work\_temp\xulnpcmgdnx.tmp"
Microsoft (R) Test Execution Command Line Tool Version 16.6.1
但是,仍然不支持“不包含”运算符。我试过了:
我不知所措,是否还有其他我不知道的依赖?这可能是微软方面的问题/错误吗?任何帮助或指示将不胜感激。
最佳答案
此问题可能与您使用的 VSTest 版本有关。这是我这边的一些测试:
因此,我建议您可以先使用 Windows 2019 代理运行管道,以检查问题是否来自 VSTest 版本。然后选择正确的版本。
关于.net - 不包含测试用例过滤器在 VSTest 16.6.1 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62718488/