Is there any Cloud version of Bitbucket Code Coverage?

Matteo Bernardini
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 22, 2022

 

Hello!

I was looking into how to visualize code coverage from a `.lcov` file into Bitbucket PRs. I found this extension but it's for Server only.

Is there any plan to have a Cloud version of the extension or is there any other solution that doesn't involve third-party providers?

I'm using `coverage.py` to generate reports, so I can easily output them in other common formats as well.

Thank you!

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 4, 2023

Hi Matteo and welcome to the community!

We provide an API endpoint for creating reports that can include code coverage information. Reports generated with this API endpoint are going to be displayed on the Reports panel of a pull request (on the right-hand sidebar). The report needs to be created for the last commit of the source branch of a pull request.

This is the API endpoint for creating reports:

You can also create annotations for each report using the following endpoint:

If you're using Pipelines for CI/CD, you can write a pipe that generates these reports, if not, you can write a script that uses our API to generate these reports.

You can also check the following documentation page for more information:

Kind regards,
Theodora

zygmunt_buszyk January 5, 2023

@Theodora Boudale 

Hello Theodara!

I want to ask you about BITBUCKET CLOUD:

What would be desired way for Report Annotation to become code coverage and be represented as color-coded blocks, telling us which  lines of code are covered with tests. (FullyPartially, or Not covered)

Exactly as in CODE COVERAGE section of Bitbucket Server documentation: https://confluence.atlassian.com/bitbucketserver/code-insights-966660485.html


 

Does Bitbucket cloud have THIS inbuilt option (like annotations enabled. Other way would be styling annotations),
Or do I have to create an Connector App / BB Cloud Plugin, to get to the interfaces Which is not ideal. That would require a lot of work and create the  need to put entire workspace in the development mode or wait for the approval correct ? (also is there a way to develop Private repository app)? 

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 11, 2023

Hi Matteo,

Annotations are displayed in the pull request diff (after they are created with our API). If you're using Pipelines you could write a pipe that creates reports and annotations, otherwise, you would need to create a plugin that does that. If you have any questions about creating a plugin you can reach out to the developer community here: https://community.developer.atlassian.com/c/bitbucket-development/bitbucket-cloud/13

Showing code coverage as color-coded blocks is not possible at the moment, because annotations can be created for a single line only. We would need to extend our annotations API endpoint to include a from field to indicate which lines are covered by the annotation.

I went ahead and created a feature request about this in our issue tracker that you can vote for to express your interest:

Kind regards,
Theodora

Like zygmunt_buszyk likes this
zygmunt_buszyk January 11, 2023

Thank you for your answer Theodora.
Altho I Do you think that adding multi line annotations would enable us to achieve the desired outcome I've posted above? 
Wouldn't adding annotation_type: (like coverage) and some magic on your side be the solution? 

Also (I didn't get into that a lot, But),  To create the desired plugin I would need to refer to some of your modules interfaces. Do you think those values would be sufficient to do what I want to achieve (aka. show code coverage as color-coded block)

 

 

On the Bitbucket Server solution you have CONTEXT and refer to fileContext  AND Bitbucket Server web resource contexts (that I would need to achieve in mine Bitbucket CLOUD) 

 

 


ass.png

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 13, 2023

Hi @zygmunt_buszyk,

You are right, I adjusted the feature request so that it doesn't focus on the multi-line part of the annotations only, and so that the desired outcome is more clear. Please make sure to add your vote as well by selecting the Vote for this issue link in that feature request, as the number of votes helps the development team and product managers better understand the demand for new features.

Regarding your other question, I am not very familiar with the module interfaces as I haven't been involved in plugin development, I would suggest asking your question in the developer community here https://community.developer.atlassian.com/c/bitbucket-development/bitbucket-cloud/13.

Kind regards,
Theodora

zygmunt_buszyk January 13, 2023

Thank you very much @Theodora Boudale , I really appreciaty it.

Like Theodora Boudale likes this
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 16, 2023

You are very welcome @zygmunt_buszyk , please feel free to reach out if you need anything further.

Matteo Bernardini
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 20, 2023

 

Hi @zygmunt_buszyk, thank you for catching up on my request, you covered exactly what I was interested in!

Thank you @Theodora Boudale for creating the feature request. Am I understanding correctly that this would provide an endpoint to upload a `.lcov` file from Bitbucket Pipelines and have colored code-blocks in the PR automatically? Or would an extra step be needed?

Like zygmunt_buszyk likes this
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 20, 2023

Hi Matteo,

The feature request was focused more on providing API endpoints that will help with showing code coverage information. Even when the endpoints are provided, an integration would need to be built using those API endpoints.

I have added the requirement to provide the option to upload the coverage file in Bitbucket Cloud, so that you won't need to build an integration yourself.

Kind regards,
Theodora

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events