void (TestIdentifier testIdentifier, TestExecutionResult.Status status, Throwable throwableOptional, String reason) { if (testIdentifier.isTest()) { final long duration = getDuration(); if (status == TestExecutionResult.Status.FAILED) { testFailure(testIdentifier, ServiceMessageTypes.TEST_FAILED, throwableOptional, duration, reason); } else if (status == TestExecutionResult.Status.ABORTED) { testFailure(testIdentifier, ServiceMessageTypes.TEST_IGNORED, throwableOptional, duration, reason); } testFinished(testIdentifier, duration); myFinishCount++; } else if (hasNonTrivialParent(testIdentifier)) { String messageName = null; if (status == TestExecutionResult.Status.FAILED) { messageName = ServiceMessageTypes.TEST_FAILED; } else if (status == TestExecutionResult.Status.ABORTED) { messageName = ServiceMessageTypes.TEST_IGNORED; } if (messageName != null) { if (status == TestExecutionResult.Status.FAILED) { String parentId = getParentId(testIdentifier); String nameAndId = " name='" + CLASS_CONFIGURATION + "' nodeId='" + escapeName(getId(testIdentifier)) + "' parentNodeId='" + escapeName(parentId) + "'"; myPrintStream.println("##teamcity[testStarted" + nameAndId + "]"); testFailure(CLASS_CONFIGURATION, getId(testIdentifier), parentId, messageName, throwableOptional, 0, reason); myPrintStream.println("##teamcity[testFinished" + nameAndId + "]"); } final Set<TestIdentifier> descendants = myTestPlan != null ? myTestPlan.getDescendants(testIdentifier) : Collections.emptySet(); if (!descendants.isEmpty() && myFinishCount == 0) { for (TestIdentifier childIdentifier : descendants) { testStarted(childIdentifier); testFailure(childIdentifier, ServiceMessageTypes.TEST_IGNORED, status == TestExecutionResult.Status.ABORTED ? throwableOptional : null, 0, reason); testFinished(childIdentifier, 0); } myFinishCount = 0; } } myPrintStream.println("##teamcity[testSuiteFinished" + idAndName(testIdentifier) + "]"); } }