Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Azure by (7k points)
edited by

It runs well but cannot see unit test result When added a build pipeline which used a classic edit or for my solution. And the code coverage also blank. I have two projects and tests project in the solution. The task returns the result as below:

Adding a unit test in Azure DevOps pipeline

    A total of 14 test files matched the specified pattern.

           No test is available in d:\a\1\s\src.net...

Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

            Results File: d:\a\_temp\TestResults\VssAdministrator_fv-az686_2019-12-26_06_10_28.trx

            Attachments:

              d:\a\_temp\TestResults\d301a26b-d99f-4b4e-bbe8-c95e588ee1c5\VssAdministrator_fv-az686 2019-12-26 06_10_20.coverage

            Vstest.console.exe exited with code 0.

            **************** Completed test execution *********************

            Test results files: d:\a\_temp\TestResults\VssAdministrator_fv-az686_2019-12-26_06_10_28.trx

            No Result Found to Publish 'd:\a\_temp\TestResults\VssAdministrator_fv-az686_2019-12-26_06_10_28.trx'.

            Created test run: 1006840

            Publishing test results: 0

            Publishing test results to test run '1006840'.

            TestResults To Publish 0, Test run id:1006840

            Published test results: 0

            Publishing Attachments: 2

            Completed TestExecution Model...

And also I cannot see any more from the Tests windows. The test YAML script as below: 

steps:

- task: VSTest@2

  displayName: 'Test Assemblies'

  inputs:

    testAssemblyVer2: |

     **\$(BuildConfiguration)\*test*.dll

     !**\obj\**

    codeCoverageEnabled: true

    platform: '$(BuildPlatform)'

    configuration: '$(BuildConfiguration)'

1 Answer

0 votes
by (31.9k points)
edited by

Your YAML is fine. Based on the error message, the test files have been identified, but it still says there's no test available, this is more relative to vstest.console.exe did not identify the test.

If its type is Nunit test, you must ensure adding reference on packages NUnit and NUnit3TestAdapter in csproj file:

<PackageReference Include="NUnit">

      <Version>3.12.0</Version>

    </PackageReference>

<PackageReference Include="NUnit3TestAdapter">

      <Version>3.15.1</Version>

    </PackageReference>

Similar method tp xUnit test.
<!--[if !supportLineBreakNewLine]--> <!--[endif]-->

Want to become Azure Developer, check out this Azure Tutorial.

Crack the Azure Certification exam, by going through our Azure Administrator Certification!

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...