lundi 29 janvier 2018

Jenkins Cobertura (with gcov) - what do the coverage statistics mean?

I'm currently writing unit tests for a Qt project. I wanted to use the statistics provided in Jenkins through the Cobertura plugin (underneath gcov is used to get the stats).

:~$ gcov -v gcov 5.4.0 20160609

:~$ gcc -v gcc version 5.4.0

However after I looked at the table (see below) I was really surprised to see the poor coverage especially of conditionals. For the first one (see Coverage Breakdown by File) I thought I was actually done, since the code has only three ifs(each with a single condition) and my tests covers all (checked this also through debugging just to make sure). So I am really confused what these numbers actually mean and how to interpret them in order to make my unit tests better.

enter image description here

I've even started thinking that some of the poor results might be due to the use of Qt since it's not exactly pure C++ and all "extras" (slots, signals, MOC files etc.) might be something that gcov can't handle properly.

Aucun commentaire:

Enregistrer un commentaire