We are using SonarQube and JaCoco maven plugin to extract test measurements, such as code coverage.
However, I find that the measurements we get are lacking and I would like to find a way to measure the number of tests per public method.
The background for this is that I noticed that it is quite possible to get 100% method, class and line coverage with a single test for a stubbed method.
Method under test
public Integer parseString(String value) {
return null;
}
Test
public void parseStringShouldReturnNullWhenNullIsProvided() {
Integer result = parseString(null);
Assert.assertNull(result);
}
The example above gives 100% coverage, but does not provide any value at all.
But if we were able to measure tests per public method this would give a measurement of 1, which should be seen as a bad result. By adding another test for this method the measurement would increase to 2 and the new test would be failing, but the coverage would still be 100%
Does anyone know of a tool that extracts this kind of measurement from a java application? Preferrably something that can be hooked in to maven as a plugin.
Aucun commentaire:
Enregistrer un commentaire