public void onJstdConfigRunningFinished(@Nullable String errorMessage, @NotNull TestFileScope testFileScope) {
ConfigNode configNode = getCurrentConfigNode();
for (BrowserNode browserNode : configNode.getChildren()) {
for (TestCaseNode testCaseNode : browserNode.getChildren()) {
for (TestNode testNode : testCaseNode.getChildren()) {
TCMessage testFailedMessage = TC.newTestFailedMessage(testNode);
String reason = errorMessage != null ? "JsTestDriver crash" : "unknown reason";
testFailedMessage.addAttribute(TCAttribute.EXCEPTION_MESSAGE, "Can't execute test due to " + reason + ".");
testFailedMessage.addAttribute(TCAttribute.IS_TEST_ERROR, "yes");
printTCMessage(testFailedMessage);
}
TCMessage testCaseFinishedMessage = TC.newTestSuiteFinishedMessage(testCaseNode);
printTCMessage(testCaseFinishedMessage);
}
TCMessage browserFinishedMessage = TC.newTestSuiteFinishedMessage(browserNode);
printTCMessage(browserFinishedMessage);
}
if (errorMessage != null) {
ConfigErrorNode configErrorNode = new ConfigErrorNode(configNode);
TCMessage startedMessage = configErrorNode.createStartedMessage();
printTCMessage(startedMessage);
TCMessage finishedMessage = TC.newConfigErrorFinishedMessage(configErrorNode);
finishedMessage.addAttribute(TCAttribute.EXCEPTION_MESSAGE, errorMessage);
printTCMessage(finishedMessage);
}
else if (configNode.getChildren().isEmpty()) {
final String message;
Map.Entry<String, Set<String>> testCaseEntry = testFileScope.getSingleTestCaseEntry();
if (testCaseEntry != null) {
Set<String> testMethodNames = testCaseEntry.getValue();
if (testMethodNames.isEmpty()) {
message = "No '" + testCaseEntry.getKey() + "' test case found or it has no tests.";
}
else {
message = "No '" + testFileScope.humanize() + "' test method found.";
}
}
else {
message = "No tests found. Please check 'test:' section of the configuration file.";
}
myErrStream.println(message);
}
TCMessage configFinishedMessage = TC.newTestSuiteFinishedMessage(configNode);
printTCMessage(configFinishedMessage);
}