-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1095 from Pfoerd/add_aggregated_results_to_report…
…_aggregator add aggregated results to report aggregator and configurable thresholds to maven aggregator mojo
- Loading branch information
Showing
8 changed files
with
157 additions
and
4 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
pitest-aggregator/src/main/java/org/pitest/aggregate/AggregationResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.pitest.aggregate; | ||
|
||
public class AggregationResult { | ||
private final long mutations; | ||
private final long mutationsSurvived; | ||
private final int mutationCoverage; | ||
|
||
private final int testStrength; | ||
|
||
public AggregationResult(long mutations, long mutationsSurvived, int mutationCoverage, int testStrength) { | ||
this.mutations = mutations; | ||
this.mutationsSurvived = mutationsSurvived; | ||
this.mutationCoverage = mutationCoverage; | ||
this.testStrength = testStrength; | ||
} | ||
|
||
public long getMutations() { | ||
return mutations; | ||
} | ||
|
||
public long getMutationsSurvived() { | ||
return mutationsSurvived; | ||
} | ||
|
||
public int getMutationCoverage() { | ||
return mutationCoverage; | ||
} | ||
|
||
public int getTestStrength() { | ||
return testStrength; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
pitest-aggregator/src/main/java/org/pitest/aggregate/ReportAggregatorResultListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.pitest.aggregate; | ||
|
||
import org.pitest.mutationtest.ClassMutationResults; | ||
import org.pitest.mutationtest.MutationResultListener; | ||
import org.pitest.mutationtest.report.html.MutationTotals; | ||
|
||
public class ReportAggregatorResultListener implements MutationResultListener { | ||
MutationTotals totals = new MutationTotals(); | ||
|
||
@Override | ||
public void runStart() { | ||
// nothing to do here | ||
} | ||
|
||
@Override | ||
public void handleMutationResult(ClassMutationResults results) { | ||
totals.addFiles(1); | ||
totals.addMutations(results.getMutations().size()); | ||
totals.addMutationsDetetcted(results.getMutations().stream().filter(mutation -> mutation.getStatus().isDetected()).count()); | ||
totals.addMutationsWithCoverage(results.getMutations().stream().filter(it -> it.getStatus().hasCoverage()).count()); | ||
} | ||
|
||
@Override | ||
public void runEnd() { | ||
// nothing to do here | ||
} | ||
|
||
public AggregationResult result() { | ||
return new AggregationResult(totals.getNumberOfMutations(), totals.getNumberOfMutations() - totals.getNumberOfMutationsDetected(), | ||
totals.getMutationCoverage(), totals.getTestStrength()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...resources/pit-sub-module/sub-module-2/src/test/java/org/example2/SystemUnderTestTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.example2; | ||
|
||
import static junit.framework.Assert.assertTrue; | ||
import static junit.framework.Assert.assertNotNull; | ||
|
||
import org.junit.Test; | ||
|
||
public class SystemUnderTestTest { | ||
|
||
@Test | ||
public void testGetNumber() { | ||
SystemUnderTest sut = new SystemUnderTest(); | ||
|
||
int result = sut.getNumber(); | ||
assertTrue(result == -25); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters