public interface NewCoverage
sensorContext.newCoverage().onFile(file) .lineHits(1, 2) .lineHits(2, 5) .lineHits(3, 0) . ... .conditions(3, 4, 2) .conditions(12, 2, 2) . ... .save();Since 6.2 you can save several reports for the same file and reports will be merged using the following "additive" strategy:
Modifier and Type | Method and Description |
---|---|
NewCoverage |
conditions(int line,
int conditions,
int coveredConditions)
Call this method as many time as needed to report coverage of conditions.
|
NewCoverage |
lineHits(int line,
int hits)
Call this method as many time as needed to report coverage hits per line.
|
NewCoverage |
ofType(CoverageType type)
Deprecated.
since 6.2 SonarQube merge all coverage reports and don't keep track of different test category
|
NewCoverage |
onFile(InputFile inputFile)
The covered file.
|
void |
save()
Call this method to save the coverage report for the given file.
|
NewCoverage onFile(InputFile inputFile)
@Deprecated NewCoverage ofType(CoverageType type)
NewCoverage lineHits(int line, int hits)
line
- Line number (starts at 1).hits
- Number of time the line was hit.NewCoverage conditions(int line, int conditions, int coveredConditions)
line
- Line number (starts at 1).conditions
- Number of conditions on this line (should be greater than 1).coveredConditions
- Number of covered conditions.void save()