All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.teamscale.jacoco.agent.testimpact.CoverageToDiskStrategy Maven / Gradle / Ivy

Go to download

JVM profiler that simplifies various aspects around recording and uploading test coverage

There is a newer version: 34.0.2
Show newest version

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);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy