Ctest in Bitbucket

Hey there.

From what you’ve described, it sounds like your current pipeline is not generating a coverage report if any unit tests fail. In my experience, build systems typically halt execution when a test fails, which could explain why the coverage report isn’t being produced in those cases.

However, it’s worth noting that SonarQube itself simply reads the coverage report that is provided—it doesn’t care whether the tests themselves pass or fail.

I would recommend checking your pipeline and test execution scripts to confirm that the coverage generation step always executes, even if some tests fail (if that’s what you want). This often involves tweaking the test commands so that failures don’t break the sequence of steps (for example, using commands like ctest --output-on-failure; [coverage command], or ensuring script steps continue after non-zero exit statuses).

You can always check what the scanner sees regarding coverage by following this guide: