gpt4 book ai didi

testing - Visual Studio 2012 vstest : run tests that do not belong to a category

转载 作者:行者123 更新时间:2023-11-28 19:40:34 25 4
gpt4 key购买 nike

是否可以从命令行运行所有属于某个类别的测试?从文档中,我知道我可以运行属于某个类别的所有测试,执行如下操作:

vstest.console.exe myTestProject.dll /TestCaseFilter:TestCategory="Nightly"

我想做的是将几个测试方法分配给一个测试类别,然后一次运行这些测试。然后我想在单独的测试运行中运行其余测试(这是我当前的问题所在)。我有超过 1000 个测试,所以我希望我不必搜索和替换所有 TestMethod 属性来添加“基本”类别。我也不想将测试分成不同的项目。

谢谢。

最佳答案

好吧,我得到了这个问题的风滚草徽章,所以我想没有人感兴趣。万一有人遇到同样的问题,我发现我可以只使用 != 运算符。 Microsoft 文档非常精简,但我在 MSDN blog "Running selective unit tests in VS 2012 RC using TestCaseFilter" 中找到了我需要的信息.

所以,答案是:

vstest.console.exe myTestProject.dll /TestCaseFilter:TestCategory!="Nightly"

更新:正如下面 Rob Bos 所指出的。文档现在有:

dotnet 测试 --filter FullyQualifiedName!=MSTestNamespace.UnitTestClass1.TestMethod1

Runs all tests except MSTestNamespace.UnitTestClass1.TestMethod1

来源Running selective unit tests在 MSDN 上。

关于testing - Visual Studio 2012 vstest : run tests that do not belong to a category,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19899985/

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