Azure Pipelines counts xUnit InlineData as one test instead of many

ⅰ亾dé卋堺 提交于 2021-01-28 09:11:02

问题


In our Azure Pipelines pipeline we have .NET Core xUnit test methods that take an InlineData parameter. The test runner runs all test methods and correctly reports in its console output each InlineData instance as a test run. However, Azure Pipelines reports a lower test count because it counts the [Theory] tests as one test (instead of one test for every instance of InlineData).

How can I make Azure Pipelines report all instances of InlineData as tests?

As an example, here's a job output.

The test job reports 9 tests. 9 tests include two [Theory] methods each with two InlineData:

Azure Pipelines only reports 7 instead of the expected 9 tests:


回答1:


I reproduced the same issue with the latest version dotnet core sdk ie. SDK Version: 3.1.402.

When i used 3.1.101 version dotnet core sdk. The Test summary showed the correct test counts.

You can try adding Use .NET Core task at the top of your pipeline and specify version of .NET Core SDK to be 3.1.101. See below:

- task: UseDotNet@2
  displayName: 'Use .NET Core sdk 3.1.101'
  inputs:
    version: 3.1.101


来源:https://stackoverflow.com/questions/64439071/azure-pipelines-counts-xunit-inlinedata-as-one-test-instead-of-many

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!