1

Let's assume I've constructed a (very simple) build pipeline in Jenkins into two jobs:

  1. Compile-and-unit-tests
  2. Integration tests

I'd ideally like to get code coverage from both sets of tests into SonarQube. Is this possible? It seems like SonarQube assumes that every update is for the entirety of the project as a single transaction.

At first I was excited to see the addition of incremental analysis, but it seems this is targeted for a different use case: doing a pre-commit check of only changed files.

If there's no way to do this in SonarQube, I'm limited to either only having available (in SonarQube at least) code coverage from the unit tests, or delaying updating the SonarQube project until after step 2--but our integration tests take a very long time, meaning the results in SonarQube would be delayed.

How are people handling this the real world?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Richard Steele
  • 2,227
  • 1
  • 15
  • 14

1 Answers1

0

Unfortunately, the SonarQube analysis must all be done at once, so you'll need to wait until your integration tests have finished and the utilize the "reuseReport" mode to consume the results of your earlier unit test run(s).

Report reuse info for Java: http://docs.codehaus.org/display/SONAR/Code+Coverage+by+Unit+Tests+for+Java+Project#CodeCoveragebyUnitTestsforJavaProject-ReusingExistingReports

For .net: http://docs.codehaus.org/display/SONAR/Unit+Tests,+Integration+Tests+and+Code+Coverage

John M. Wright
  • 4,477
  • 1
  • 43
  • 61
  • Just want to say you'r .NET-link is dead... If I find a new one I'll add it here – Ward Dec 05 '17 at 14:14
  • Yeah, the .NET ecosystem for SonarQube has been completely redone since this answer was posted in 2014. This may be a good starting place: https://docs.sonarqube.org/pages/viewpage.action?pageId=6389772 – John M. Wright Dec 05 '17 at 15:22