Search in sources :

Example 1 with Coverage

use of eu.stamp.project.testrunner.runner.coverage.Coverage in project dspot by STAMP-project.

the class CloverCoverageSelector method report.

@Override
public void report() {
    final Coverage amplifiedCoverage = computeAmplifiedCoverage();
    final String nl = System.getProperty("line.separator");
    final StringBuilder report = new StringBuilder();
    report.append("======= REPORT =======").append(nl);
    report.append("Initial Coverage: ").append(this.initialCoverage.toString()).append(nl);
    report.append("The amplification results with: ").append(this.selectedAmplifiedTest.size()).append(" amplified test cases").append(nl);
    report.append("Amplified Coverage: ").append(amplifiedCoverage.toString()).append(nl);
    System.out.println(report.toString());
    File reportDir = new File(this.configuration.getOutputDirectory());
    if (!reportDir.exists()) {
        reportDir.mkdir();
    }
    if (this.currentClassTestToBeAmplified != null) {
        try (FileWriter writer = new FileWriter(this.configuration.getOutputDirectory() + "/" + this.currentClassTestToBeAmplified.getQualifiedName() + "_clover_coverage.txt", false)) {
            writer.write(report.toString());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
    this.currentClassTestToBeAmplified = null;
}
Also used : FileWriter(java.io.FileWriter) Coverage(eu.stamp.project.testrunner.runner.coverage.Coverage) IOException(java.io.IOException) File(java.io.File)

Aggregations

Coverage (eu.stamp.project.testrunner.runner.coverage.Coverage)1 File (java.io.File)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1