Search in sources :

Example 1 with ETestExecutionResult

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

the class CommandLineInterface method endTest.

private void endTest() throws Exception {
    if (arguments.size() < 2) {
        throw new InvalidCommandLineException("You must provide the uniform path of the test that is about to be started" + " as the first argument of the endTest command and the test result as the second.");
    }
    String uniformPath = arguments.remove(0);
    ETestExecutionResult result = ETestExecutionResult.valueOf(arguments.remove(0).toUpperCase());
    String message = readStdin();
    // the agent already records test duration, so we can simply provide a dummy value here
    TestExecution execution = new TestExecution(uniformPath, 0L, result, message);
    AgentCommunicationUtils.handleRequestError(() -> api.testFinished(uniformPath, execution), "Failed to end coverage recording for test case " + uniformPath + ". Coverage for that test case is most likely lost.");
}
Also used : ETestExecutionResult(com.teamscale.report.testwise.model.ETestExecutionResult) TestExecution(com.teamscale.report.testwise.model.TestExecution)

Example 2 with ETestExecutionResult

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

the class JUnit5TestwiseCoverageExecutionListener method executionFinished.

@Override
public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) {
    if (!testIdentifier.isTest()) {
        return;
    }
    String uniformPath = getUniformPath(testIdentifier);
    ETestExecutionResult result;
    switch(testExecutionResult.getStatus()) {
        case SUCCESSFUL:
            result = ETestExecutionResult.PASSED;
            break;
        case ABORTED:
            result = ETestExecutionResult.ERROR;
            break;
        case FAILED:
        default:
            result = ETestExecutionResult.FAILURE;
            break;
    }
    bridge.testFinished(uniformPath, result);
}
Also used : ETestExecutionResult(com.teamscale.report.testwise.model.ETestExecutionResult)

Aggregations

ETestExecutionResult (com.teamscale.report.testwise.model.ETestExecutionResult)2 TestExecution (com.teamscale.report.testwise.model.TestExecution)1