Search in sources :

Example 1 with TeamscaleMockServer

use of com.teamscale.test.commons.TeamscaleMockServer in project teamscale-jacoco-agent by cqse.

the class HttpRedirectSystemTest method systemTest.

@Test
public void systemTest() throws Exception {
    System.setProperty("org.eclipse.jetty.util.log.class", "org.eclipse.jetty.util.log.StdErrLog");
    System.setProperty("org.eclipse.jetty.LEVEL", "OFF");
    RedirectMockServer redirectMockServer = new RedirectMockServer(FAKE_REDIRECT_PORT, FAKE_TEAMSCALE_PORT);
    TeamscaleMockServer teamscaleMockServer = new TeamscaleMockServer(FAKE_TEAMSCALE_PORT);
    new SystemUnderTest().foo();
    dumpCoverage();
    assertThat(teamscaleMockServer.uploadedReports).hasSize(1);
    redirectMockServer.shutdown();
    teamscaleMockServer.shutdown();
}
Also used : TeamscaleMockServer(com.teamscale.test.commons.TeamscaleMockServer) SystemUnderTest(systemundertest.SystemUnderTest) Test(org.junit.jupiter.api.Test) SystemUnderTest(systemundertest.SystemUnderTest)

Example 2 with TeamscaleMockServer

use of com.teamscale.test.commons.TeamscaleMockServer in project teamscale-jacoco-agent by cqse.

the class TiaClientSystemTest method systemTest.

@Test
public void systemTest() throws Exception {
    TeamscaleMockServer teamscaleMockServer = new TeamscaleMockServer(FAKE_TEAMSCALE_PORT, "testFoo", "testBar");
    CustomTestFramework customTestFramework = new CustomTestFramework(AGENT_PORT);
    customTestFramework.runTestsWithTia();
    assertThat(teamscaleMockServer.uploadedReports).hasSize(1);
    TestwiseCoverageReport report = teamscaleMockServer.parseUploadedTestwiseCoverageReport(0);
    assertThat(report.tests).hasSize(2);
    assertAll(() -> {
        assertThat(report.tests).extracting(test -> test.uniformPath).containsExactlyInAnyOrder("testBar", "testFoo");
        assertThat(report.tests).extracting(test -> test.result).containsExactlyInAnyOrder(ETestExecutionResult.FAILURE, ETestExecutionResult.PASSED);
        assertThat(report.tests).extracting(TiaClientSystemTest::getCoverageString).containsExactlyInAnyOrder("SystemUnderTest.java:4,13", "SystemUnderTest.java:4,8");
    });
}
Also used : Test(org.junit.jupiter.api.Test) TestInfo(com.teamscale.report.testwise.model.TestInfo) TeamscaleMockServer(com.teamscale.test.commons.TeamscaleMockServer) TestwiseCoverageReport(com.teamscale.report.testwise.model.TestwiseCoverageReport) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Assertions.assertAll(org.junit.jupiter.api.Assertions.assertAll) CustomTestFramework(testframework.CustomTestFramework) Collectors(java.util.stream.Collectors) ETestExecutionResult(com.teamscale.report.testwise.model.ETestExecutionResult) TeamscaleMockServer(com.teamscale.test.commons.TeamscaleMockServer) TestwiseCoverageReport(com.teamscale.report.testwise.model.TestwiseCoverageReport) CustomTestFramework(testframework.CustomTestFramework) Test(org.junit.jupiter.api.Test)

Example 3 with TeamscaleMockServer

use of com.teamscale.test.commons.TeamscaleMockServer in project teamscale-jacoco-agent by cqse.

the class DefaultExcludesSystemTest method systemTest.

@Test
public void systemTest() throws Exception {
    System.setProperty("org.eclipse.jetty.util.log.class", "org.eclipse.jetty.util.log.StdErrLog");
    System.setProperty("org.eclipse.jetty.LEVEL", "OFF");
    TeamscaleMockServer teamscaleMockServer = new TeamscaleMockServer(FAKE_TEAMSCALE_PORT);
    new SystemUnderTest().foo();
    dumpCoverage();
    assertThat(teamscaleMockServer.uploadedReports).hasSize(1);
    String report = teamscaleMockServer.uploadedReports.get(0);
    assertThat(report).doesNotContain("shadow");
    assertThat(report).doesNotContain("junit");
    assertThat(report).doesNotContain("eclipse");
    assertThat(report).doesNotContain("apache");
    assertThat(report).doesNotContain("javax");
    assertThat(report).doesNotContain("slf4j");
    assertThat(report).doesNotContain("com/sun");
    assertThat(report).contains("SystemUnderTest");
    assertThat(report).contains("NotExcludedClass");
}
Also used : TeamscaleMockServer(com.teamscale.test.commons.TeamscaleMockServer) SystemUnderTest(systemundertest.SystemUnderTest) Test(org.junit.jupiter.api.Test) SystemUnderTest(systemundertest.SystemUnderTest)

Aggregations

TeamscaleMockServer (com.teamscale.test.commons.TeamscaleMockServer)3 Test (org.junit.jupiter.api.Test)3 SystemUnderTest (systemundertest.SystemUnderTest)2 ETestExecutionResult (com.teamscale.report.testwise.model.ETestExecutionResult)1 TestInfo (com.teamscale.report.testwise.model.TestInfo)1 TestwiseCoverageReport (com.teamscale.report.testwise.model.TestwiseCoverageReport)1 Collectors (java.util.stream.Collectors)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Assertions.assertAll (org.junit.jupiter.api.Assertions.assertAll)1 CustomTestFramework (testframework.CustomTestFramework)1