protected void visitSet(TestResult testResult) { for (ConfigResult configResult : testResult.getSubResults()) { if (configResult.getState() == State.FAILURE) { visitConfig(testResult, configResult); } } }
protected void visitConfig(TestResult testResult, ConfigResult configResult) { // the faulty command is necessarily the last one List<CommandResult> commandResults = configResult.getSubResults(); CommandResult commandResult = commandResults.get(commandResults.size() - 1); sb.append("Test: \"") .append(testResult.getTestElem().getName()) .append("\" Config: \"") .append(configResult.getTestElem().getName()) .append("\" FAILLED\n"); sb.append(" Command: ").append(commandResult.getExecutedCommand()).append("\n"); Iterator<String> commandArgs = commandResult.getCommandArgs().iterator(); if (commandArgs.hasNext()) { sb.append(" args: ").append(commandArgs.next()).append("\n"); while (commandArgs.hasNext()) { sb.append(" ").append(commandArgs.next()).append("\n"); } } sb.append(" Output: "); for (String outputLine : commandResult.getOutput().split("\n")) { sb.append(outputLine).append("\n "); } sb.append( "\n================================================================================\n\n"); }
protected void visitTestSet(TestSetResult testSetResult) { sb.append("================================================================================\n"); sb.append(" Test Set \"").append(testSetResult.getTestElem().getName()).append("\"\n"); sb.append(" Tests run: ") .append(testSetResult.getNbTests()) .append(", Failures: ") .append(testSetResult.getNbFailure()) .append(", Skipped: ") .append(testSetResult.getNbSkipped()); sb.append(" Time elapsed: ").append(testSetResult.formatExecutionTime()); sb.append( "\n================================================================================\n\n"); if (testSetResult.getState() == State.FAILURE) { for (TestResult testResult : testSetResult.getSubResults()) { if (testResult.getState() == State.FAILURE) { visitSet(testResult); } } } }