bitbucket-branch-source-plugin icon indicating copy to clipboard operation
bitbucket-branch-source-plugin copied to clipboard

Send Junit Tests to Bitbuckt Reports

Open sanguis opened this issue 3 years ago • 2 comments

Dependencies

Feature Request

If any junit tests are created in the Jenkins build, send a report to the commit. https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/commit/%7Bcommit%7D/reports/%7BreportId%7D#put

sanguis avatar Nov 19 '21 18:11 sanguis

maybe make it one of the pipeline behaviours you can set. Then you could also config the path (maybe ant glob pattern) to search in for report xml's

nilsmahlstaedt avatar Jun 02 '23 14:06 nilsmahlstaedt

What kind of data do you expect to send to the Code Insights feature of Bitbucket Cloud: just the number of passed/failed tests, or something more complex?

The Code Insights report can contain "data fields" with names and values, but no more than 10, so those are not useful for listing the results of individual tests.

The Code Insights report can also contain "annotations" that apply to lines of files, but AFAIK JUnit tests do not output that kind of information.

The JUnit plugin already includes JUnitChecksPublisher.java for sending test results to Checks API. However:

  • The report model of Checks API largely matches what GitHub expects, and doesn't fit Code Insights very well. In Checks API, each report can have a summary and text in Markdown format, and the JUnit plugin output most of its data that way; but Code Insights supports neither Markdown nor HTML in reports, so the formatted data cannot be used there. Better results could perhaps be achieved by bypassing Checks API and translating the JUnit test results to a Code Insights report in Bitbucket-specific code.
  • The Jenkins project doesn't yet provide any plugins for connecting Checks API to Bitbucket Cloud, Data Center, or Server.

The Code Insights feature of Bitbucket Data Center and Server is not API compatible with that of Bitbucket Cloud, so the client side would have to be implemented separately for each. There is similarly bifurcated code in the Bitbucket Branch Source plugin already.

Incidentally, the Store a build status and Create build status for commit (deprecated) APIs of Bitbucket Data Center support storing the number of failed, skipped, and successful tests, although the Bitbucket Branch Source plugin doesn't use that feature. The corresponding Create a build status for a commit API of Bitbucket Cloud doesn't seem to support structured data like that, but one can format the numbers as text and set that as the build description.

KalleOlaviNiemitalo avatar Jun 02 '23 15:06 KalleOlaviNiemitalo