[英]Azure Devops - Unit test methods of type [DataTestMethod] not executed in YAML builds
While running unit tests as part of Azure CI pipeline (YAML)作为 Azure CI 管道 (YAML) 的一部分运行单元测试时
Test methods [DataTestMethod] are not executed.不执行测试方法 [DataTestMethod]。 But [TestMethod] is working fine.但是 [TestMethod] 工作正常。
The following yaml works fine on the newest version of Azure Devops (cloud).以下 yaml 在最新版本的 Azure Devops(云)上运行良好。
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
projects: path/to/.csproj
arguments: '--configuration $(BuildConfiguration)'
Make sure it also works fine on your local machine to avoid it being any issues with the code.确保它在您的本地机器上也能正常工作,以避免代码出现任何问题。
To answer your bonus question回答你的奖金问题
" Well you can either add a test category and filter it on the category, or filter it on the test projects if you have multiple of them. " 好吧,您可以添加一个测试类别并在类别上对其进行过滤,或者如果您有多个测试项目,则在测试项目上对其进行过滤。
I would probably do it with test categories我可能会用测试类别来做
[Category("MainTest")]
[Test]
public void TestMethod1()
{
Assert.True(true);
}
And then in your yaml you should be able to do something like然后在您的 yaml 中您应该能够执行类似的操作
testFiltercriteria: 'TestCategory=MainTest'
" testFiltercriteria: 'TestCategory=MainTest'
"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.