Answers: <p>If you use python and GitLab like I do, you can include a test coverage report in your CI/CD pipeline. You <code>pip install coverage</code> and then just run <code>coverage</code> in your pipeline. The following is an excerpt from an AWS lambda pipeline, but you should be able to find something similar for your environment:</p>
  
  <pre><code> script:
      - pip install -r ./awslambda/requirements.txt
      - coverage run -m unittest discover -v -s "./awslambda" -p "*_test.py"
      - coverage report
  </code></pre>
  
  <p>The above generates a nice code coverage report and it is free of charge, for Python, AWS and GitLab. </p>
  
Answers: CC BY-SA 4.0
Answers: 2018-11-28T16:21:28.680Z
Answers: Thanks, however I need to implement something similar in Azure DevOps builds.
Answers: Emil
Answers: CC BY-SA 4.0
Answers: 2018-11-28T08:12:15.637Z
Answers: 2018-11-28T08:12:15.637Z
Answers: Niklas Rosencrantz
Answers: <p>You can use sonarqube. It does not generate its own test coverage report, but re-uses the coverage file of your existing pipelines.</p>
  
Answers: CC BY-SA 4.0
Answers: 2018-11-27T09:13:01.543Z
Answers: 2019-01-01T02:40:31.270Z
Answers: 2019-01-01T02:40:31.270Z
Answers: Meiram Chuzhenbayev
Body: <p>We are using private git repositories in Azure DevOps and I have a requirement to create code coverage report across git repositories. Our build CI/CD pipelines are using both <a href="https://www.jetbrains.com/teamcity/" rel="noreferrer">TeamCity</a> &amp; <a href="https://azure.microsoft.com/en-us/solutions/devops" rel="noreferrer">Azure DevOps</a>.
  I have looked at options and there is no straightforward solution to this problem. I am thinking about the following options:</p>
  
  <ul>
  <li>using service like <a href="https://coveralls.io/features" rel="noreferrer">coveralls.io</a>, there is an option to add private repositories; the drawback it is subscription based service</li>
  <li>using <a href="https://confluence.jetbrains.com/display/TW/SonarQube+plugin" rel="noreferrer">TeamCity SonarQube plugin</a>; It is not ideal and limited to the plugin features; I haven't tried it yet.</li>
  <li>using custom script to query and aggregate existing code coverage metrics of last successful build in TeamCity/Azure DevOps across projects and group them by repository; Both <a href="https://docs.microsoft.com/en-gb/rest/api/azure/devops/?view=azure-devops-rest-4.1" rel="noreferrer">Azure DevOps</a> &amp; <a href="https://confluence.jetbrains.com/display/TCD10/REST+API" rel="noreferrer">TeamCity</a> offer REST APIs that can be used to get the data.</li>
  </ul>
  
  <p>I still need a solution for Azure DevOps builds, however I have to admit I have not researched this properly yet.</p>
  
  <p><strong>Has anyone done cross repository code coverage reporting and what approach/tools might be best</strong>?</p>
  
Tags: <azure-devops><teamcity><code-coverage>
Title: How to report Code Coverage metrics across git repositories?
UserDisplayName: Emil
ThreadText: # How to report Code Coverage metrics across git repositories?
  
  (Asked by: username_0 on 2018-11-26)
  
  We are using private git repositories in Azure DevOps and I have a requirement to create code coverage report across git repositories. Our build CI/CD pipelines are using both [TeamCity](https://www.jetbrains.com/teamcity/) & [Azure DevOps](https://azure.microsoft.com/en-us/solutions/devops).
  I have looked at options and there is no straightforward solution to this problem. I am thinking about the following options:
  
  * using service like [coveralls.io](https://coveralls.io/features), there is an option to add private repositories; the drawback it is subscription based service
  * using [TeamCity SonarQube plugin](https://confluence.jetbrains.com/display/TW/SonarQube+plugin); It is not ideal and limited to the plugin features; I haven't tried it yet.
  * using custom script to query and aggregate existing code coverage metrics of last successful build in TeamCity/Azure DevOps across projects and group them by repository; Both [Azure DevOps](https://docs.microsoft.com/en-gb/rest/api/azure/devops/?view=azure-devops-rest-4.1) & [TeamCity](https://confluence.jetbrains.com/display/TCD10/REST+API) offer REST APIs that can be used to get the data.
  
  I still need a solution for Azure DevOps builds, however I have to admit I have not researched this properly yet.
  
  **Has anyone done cross repository code coverage reporting and what approach/tools might be best**?
  
  **Tags:** azure-devops, teamcity, code-coverage
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-11-28. Score: 3
  
  If you use python and GitLab like I do, you can include a test coverage report in your CI/CD pipeline. You `pip install coverage` and then just run `coverage` in your pipeline. The following is an excerpt from an AWS lambda pipeline, but you should be able to find something similar for your environment:
  
  ```
   script:
      - pip install -r ./awslambda/requirements.txt
      - coverage run -m unittest discover -v -s "./awslambda" -p "*_test.py"
      - coverage report
  
  ```
  
  The above generates a nice code coverage report and it is free of charge, for Python, AWS and GitLab.
  
  > **Comments:**
  > **username_0**: Thanks, however I need to implement something similar in Azure DevOps builds.  
  
  ---
  
  ### Answer by username_2 on 2018-11-27. Score: 1
  
  You can use sonarqube. It does not generate its own test coverage report, but re-uses the coverage file of your existing pipelines.
  
  
  ---
  
  