Skip to content

Azure DevOps Task which converts .coverage file into .coveragexml to be used with Report Generator in Azure Pipeline.

License

Notifications You must be signed in to change notification settings

Rogeriohsjr/CoverageConverter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coverage Converter

This Task converts .coverage file into .coveragexml to be used with Report Generator.

😏 Motivation/Points:

  • I created this extension to help my pipeline process.
  • Instead building a script which I would use only for me, I rather share the same code with everyone, so people don't need to waste their time searching for things that should be out of the box.
  • Learning some new stuff like AzureDevOps Tasks and a bit of Node.

⚠️ Things to keep in mind

📐 How to setup this pipeline?

Basically we need to add these tasks in Azure DevOps.

  1. Execute Code Coverage(CoverageConverter@0)
    1. This task will execute vsTest.exe which is the same used when we use VSTest@2 in azure DevOps.
    2. The result of vsTest.exe is the *.coverage files.
    3. The task will get all *.coverage file and covert into *.coveragexml, which is the format that Report Generator uses to generate a nice interface in Azure DevOps.
  2. Execute Report Generator(reportgenerator@4) to generate the Reports
    1. This task will get the .coveragexml that we generated and generate the reports into a folder.
  3. Execute Publish Code Coverage Results task(PublishCodeCoverageResults@1)
    1. This Task will get the Report and publish into Azure Code Coverage Tab.

Example of YML Files

Azure Pipeline YML File - Example 1

⚙️ How does the convertion works?

Take a look in the code, I tried to comment the code to make that easier to understand. It is all in one file.

https://github.com/Rogeriohsjr/AzureDevOpsTask/blob/master/buildAndReleaseTask/index.ts