Search in sources :

Example 6 with TestwiseCoverage

use of com.teamscale.report.testwise.model.TestwiseCoverage in project teamscale-jacoco-agent by cqse.

the class CoverageToTeamscaleStrategyTest method shouldRecordCoverageForTestsEvenIfNotProvidedAsAvailableTest.

@Test
public void shouldRecordCoverageForTestsEvenIfNotProvidedAsAvailableTest() throws Exception {
    AgentOptions options = mockOptions();
    CoverageToTeamscaleStrategy strategy = new CoverageToTeamscaleStrategy(controller, options, reportGenerator);
    TestwiseCoverage testwiseCoverage = getDummyTestwiseCoverage("mytest");
    when(reportGenerator.convert(any(File.class))).thenReturn(testwiseCoverage);
    // we skip testRunStart and don't provide any available tests
    strategy.testStart("mytest");
    strategy.testEnd("mytest", new TestExecution("mytest", 0L, ETestExecutionResult.PASSED));
    strategy.testRunEnd();
    verify(client).uploadReport(eq(EReportFormat.TESTWISE_COVERAGE), matches("\\Q{\"tests\":[{\"duration\":\\E[^,]*\\Q,\"paths\":[{\"files\":[{\"coveredLines\":\"1-4\",\"fileName\":\"Main.java\"}],\"path\":\"src/main/java\"}],\"result\":\"PASSED\",\"sourcePath\":\"mytest\",\"uniformPath\":\"mytest\"}]}\\E"), any(), any(), any(), any());
}
Also used : TestwiseCoverage(com.teamscale.report.testwise.model.TestwiseCoverage) TestExecution(com.teamscale.report.testwise.model.TestExecution) File(java.io.File) AgentOptions(com.teamscale.jacoco.agent.options.AgentOptions) PrioritizableTest(com.teamscale.client.PrioritizableTest) Test(org.junit.jupiter.api.Test)

Aggregations

TestwiseCoverage (com.teamscale.report.testwise.model.TestwiseCoverage)6 File (java.io.File)4 AgentOptions (com.teamscale.jacoco.agent.options.AgentOptions)3 TestExecution (com.teamscale.report.testwise.model.TestExecution)3 ClusteredTestDetails (com.teamscale.client.ClusteredTestDetails)2 PrioritizableTest (com.teamscale.client.PrioritizableTest)2 JacocoRuntimeController (com.teamscale.jacoco.agent.JacocoRuntimeController)2 TestCoverageBuilder (com.teamscale.report.testwise.model.builder.TestCoverageBuilder)2 Test (org.junit.jupiter.api.Test)2 JsonAdapter (com.squareup.moshi.JsonAdapter)1 Moshi (com.squareup.moshi.Moshi)1 EReportFormat (com.teamscale.client.EReportFormat)1 PrioritizableTestCluster (com.teamscale.client.PrioritizableTestCluster)1 TeamscaleConfig (com.teamscale.jacoco.agent.upload.teamscale.TeamscaleConfig)1 LoggingUtils (com.teamscale.jacoco.agent.util.LoggingUtils)1 JaCoCoTestwiseReportGenerator (com.teamscale.report.testwise.jacoco.JaCoCoTestwiseReportGenerator)1 CoverageGenerationException (com.teamscale.report.testwise.jacoco.cache.CoverageGenerationException)1 TestwiseCoverageReport (com.teamscale.report.testwise.model.TestwiseCoverageReport)1 FileCoverageBuilder (com.teamscale.report.testwise.model.builder.FileCoverageBuilder)1 TestwiseCoverageReportBuilder (com.teamscale.report.testwise.model.builder.TestwiseCoverageReportBuilder)1