4

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 & Azure 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, there is an option to add private repositories; the drawback it is subscription based service
  • using TeamCity 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 & TeamCity 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?

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.

  • Thanks, however I need to implement something similar in Azure DevOps builds. – Emil Nov 28 '18 at 16:21
1

You can use sonarqube. It does not generate its own test coverage report, but re-uses the coverage file of your existing pipelines.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.