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

I there a way to output multiple formats #161

Closed
minuz opened this issue Jul 23, 2018 · 9 comments
Closed

I there a way to output multiple formats #161

minuz opened this issue Jul 23, 2018 · 9 comments

Comments

@minuz
Copy link

minuz commented Jul 23, 2018

Is there any way to output multiple formats?
For instance, I would like to output in cobertura and open cover formats at the same time for integration on build server.

@tonerdo
Copy link
Collaborator

tonerdo commented Jul 23, 2018

@minuz yes there is. If you're using the MSBuild package separate the formats using a comma (,), with the global tool specify the --format (or -f) option multiple times

@tonerdo tonerdo closed this as completed Jul 23, 2018
@minuz
Copy link
Author

minuz commented Jul 23, 2018

@tonerdo thanks for the quick response. However, I've tried the following:

dotnet test -c Release --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura,opencover

But this is not working. If I duplicate the /p:CoverletOutputFormat , it only generates the later.

image

@rycornell
Copy link

I'm seeing the same behavior when running the tests on VSTS build server, using coverlet.msbuild version 2.0.1:

image

@tonerdo
Copy link
Collaborator

tonerdo commented Aug 1, 2018

@minuz @rycornell the error is as a result of a limitation with MSBuild command line parsing. You have to escape comma separated property values.

dotnet test -c Release --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=\"cobertura,opencover\"

@minuz
Copy link
Author

minuz commented Aug 1, 2018

@tonerdo thanks!! I wasn't aware of that! It works now!

@rycornell
Copy link

To get this to work on TFS, you'll need to put the entire arguments line in quotes and escape the commas separated values:
"/p:CollectCoverage=true /p:CoverletOutputFormat=\"cobertura,opencover\""

@raphaelquati
Copy link

I'm trying to run in VSTS, but no success.

I have used:
"/p:CollectCoverage=true /p:CoverletOutputFormat=\"cobertura,opencover\""
It doesn't work.

image

Checking my private agent logs:

C:\agent_diag\Worker_20180814-210029-utc.log

{
      "inputs": {
        "command": "test",
        "publishWebProjects": "true",
        "projects": "**/*.Tests.csproj",
        "custom": "",
        "arguments": "-v diag \"/p:CollectCoverage=true /p:CoverletOutputFormat=\\\"cobertura,opencover\\\"\"",
        "publishTestResults": "true",
        "zipAfterPublish": "true",
        "modifyOutputPath": "true",
        "selectOrConfig": "select",
        "feedRestore": "",
        "includeNuGetOrg": "true",
        "nugetConfigPath": "",
        "externalEndpoints": "",
        "noCache": "false",
        "packagesDirectory": "",
        "verbosityRestore": "Detailed",
        "searchPatternPush": "$(Build.ArtifactStagingDirectory)/*.nupkg",
        "nuGetFeedType": "internal",
        "feedPublish": "",
        "externalEndpoint": "",
        "searchPatternPack": "**/*.csproj",
        "configurationToPack": "$(BuildConfiguration)",
        "outputDir": "$(Build.ArtifactStagingDirectory)",
        "nobuild": "false",
        "versioningScheme": "off",
        "versionEnvVar": "",
        "requestedMajorVersion": "1",
        "requestedMinorVersion": "0",
        "requestedPatchVersion": "0",
        "buildProperties": "",
        "verbosityPack": "Detailed",
        "workingDirectory": ""
      },
      "type": "task",
      "reference": {
        "id": "5541a522-603c-47ad-91fc-a4b1d163081b",
        "name": "DotNetCoreCLI",
        "version": "2.137.4"
      },
      "condition": "succeeded()",
      "continueOnError": true,
      "id": "26c6dddb-4a82-50b8-6720-1739ac4bd89c",
      "name": "DotNetCoreCLI3",
      "displayName": "dotnet test"
    },

In dotnet test log (diagnostic on)
image

@raphaelquati
Copy link

Now it's working, with a little modification:

/p:CollectCoverage=true "/p:CoverletOutputFormat=\"cobertura,opencover\""

@leandroribeiro
Copy link

leandroribeiro commented Aug 23, 2021

For someone that this information can be useful, on Windows =( do you need do this:
"/p:CoverletOutputFormat=json%2copenconver"
Do you need replace comma [,] by [%2c]

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

No branches or pull requests

5 participants