Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VsTest Code Coverage is not published as artifact #14795

Closed
gthvidsten opened this issue May 3, 2021 · 8 comments
Closed

VsTest Code Coverage is not published as artifact #14795

gthvidsten opened this issue May 3, 2021 · 8 comments

Comments

@gthvidsten
Copy link

Type: Bug
Task name: VSTest

Environment

Server: Azure Pipelines
Account name, team project name, build definition name/build number: Can be provided on demand. I do not want to share business information here.

Agent: Private

Agent variable Value
Agent.Version 2.168.2
Agent.OS Windows_NT
Agent.OSArchitecture X64
Agent.OSVersion 10.0.14393

Issue Description

I have a Visual Studio Test task in my build pipeline:

steps:
- task: VSTest@2
  displayName: 'Unit test solution'
  inputs:
    testAssemblyVer2: |
     **\*UnitTests.dll
     !**\obj\**
    vsTestVersion: toolsInstaller
    codeCoverageEnabled: true

As you can see, Code Coverage is enabled. In the logs I can see that the .coverage file is generated, but it is never published in the artifact for the pipeline, nor is it parsed by the pipeline (there is no "code coverage" tab visible in the finished pipeline).

This is somewhat related to #11677 but not excatly the same.

Task logs

Debug log. I have edited out business critical information:

UnitTestDebugOutput.txt

From this log it certainly looks like the .coverage file is published, but it still does not appear inside the "1 published; 1 consumed" artifacts, and the "code coverage" tab is not visible (and it still only says "Setup code coverage" instead of displaying the actual results).
It actually looks like it's trying to publish a different file location than what has been generated. These two does not match:

Type Path
Generated C:\VSTSAgent_work_temp\TestResults\f811a5af-f624-44d2-806d-5dd8eef7154f\BuildServerName$_BuildServerName_2021-05-03.12_54_19.coverage
To be published C:\VSTSAgent_work_temp\TestResults\BuildServerName$_BuildServerName_2021-05-03_12_54_27\In\BuildServerName\BuildServerName$_BuildServerName_2021-05-03.12_54_19.coverage
@gthvidsten
Copy link
Author

Anybody have any updates about this?

@github-actions
Copy link

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

@github-actions github-actions bot added the stale label Dec 13, 2021
@gthvidsten
Copy link
Author

Still no updates?!

@github-actions github-actions bot removed the stale label Dec 13, 2021
@gioce90
Copy link

gioce90 commented Feb 15, 2022

You can resolve this in two ways:

First, directly with DotNetCoreCLI task:

  - task: DotNetCoreCLI@2
    displayName: 'DotNetCoreCLI Test with report (.coverage format)'
    inputs:
      command: test
      projects: '**/**.Tests.csproj' # if multiple test projects are to be executed, create a dirs.proj and use it here. That will ensure the tests are executed in parallel
      arguments: '--collect "Code Coverage" '
      publishTestResults: true

Or without publishTestResults: true, but using PublishCodeCoverageResults. You can check here an example: microsoft/vstest#981 (comment)

@gthvidsten
Copy link
Author

Thanks for the suggestion, but I'm running .NET Framework, not .NET Core

@github-actions
Copy link

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

@github-actions github-actions bot added the stale label Aug 14, 2022
@gthvidsten
Copy link
Author

Comment to keep issue open

@github-actions github-actions bot removed the stale label Aug 15, 2022
@github-actions
Copy link

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants