com.teamscale.jacoco.agent.testimpact.CoverageToDiskStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of teamscale-jacoco-agent Show documentation
Show all versions of teamscale-jacoco-agent Show documentation
JVM profiler that simplifies various aspects around recording and uploading test coverage
package com.teamscale.jacoco.agent.testimpact;
import com.teamscale.jacoco.agent.JacocoRuntimeController;
import com.teamscale.jacoco.agent.options.AgentOptions;
import com.teamscale.report.testwise.jacoco.JaCoCoTestwiseReportGenerator;
import org.conqat.lib.commons.filesystem.FileSystemUtils;
import java.io.File;
import java.io.IOException;
/**
* Strategy for appending coverage into one json test-wise coverage file with one session per test.
*/
public class CoverageToDiskStrategy extends CoverageToJsonStrategyBase {
public CoverageToDiskStrategy(JacocoRuntimeController controller, AgentOptions agentOptions,
JaCoCoTestwiseReportGenerator reportGenerator) {
super(controller, agentOptions, reportGenerator);
}
@Override
protected void handleTestwiseCoverageJsonReady(String json) throws IOException {
File reportFile = agentOptions.createNewFileInPartitionOutputDirectory("testwise-coverage", "json");
FileSystemUtils.writeFileUTF8(reportFile, json);
}
}