NIHVIVO-239 Return a non-zero error code if the task finds any errors or warnings.
This commit is contained in:
parent
7e730cb0a0
commit
d34b0deeff
3 changed files with 13 additions and 5 deletions
|
@ -57,7 +57,7 @@ public class OutputManager {
|
|||
* Parse each of the output files from the test suites, and create a unified
|
||||
* output file.
|
||||
*/
|
||||
public void summarizeOutput() {
|
||||
public Status summarizeOutput() {
|
||||
LogStats log = LogStats.parse(parms.getLogFile());
|
||||
|
||||
List<SuiteStats> suites = new ArrayList<SuiteStats>();
|
||||
|
@ -71,6 +71,7 @@ public class OutputManager {
|
|||
|
||||
OutputSummaryFormatter formatter = new OutputSummaryFormatter(parms);
|
||||
formatter.format(log, suites);
|
||||
return formatter.figureOverallStatus(log, suites);
|
||||
}
|
||||
|
||||
private static class HtmlFileFilter implements FileFilter {
|
||||
|
|
|
@ -89,7 +89,7 @@ public class OutputSummaryFormatter {
|
|||
/**
|
||||
* The overall status for the run is the worst status of any component.
|
||||
*/
|
||||
private Status figureOverallStatus(LogStats log, List<SuiteStats> suites) {
|
||||
public Status figureOverallStatus(LogStats log, List<SuiteStats> suites) {
|
||||
if (log.hasErrors()) {
|
||||
return Status.ERROR;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@ public class SeleniumRunner {
|
|||
this.outputManager = new OutputManager(parms);
|
||||
}
|
||||
|
||||
public void runSelectedSuites() {
|
||||
public boolean runSelectedSuites() {
|
||||
boolean success;
|
||||
try {
|
||||
listener.runStarted();
|
||||
outputManager.cleanOutputDirectory();
|
||||
|
@ -52,15 +53,18 @@ public class SeleniumRunner {
|
|||
listener.suiteStopped(suiteDir);
|
||||
}
|
||||
listener.runEndTime();
|
||||
outputManager.summarizeOutput();
|
||||
success = true;
|
||||
} catch (IOException e) {
|
||||
listener.runFailed(e);
|
||||
success = false;
|
||||
e.printStackTrace();
|
||||
} catch (FatalException e) {
|
||||
listener.runFailed(e);
|
||||
success = false;
|
||||
e.printStackTrace();
|
||||
}
|
||||
listener.runStopped();
|
||||
return success;
|
||||
}
|
||||
|
||||
private static void selectAllSuites(SeleniumRunnerParameters parms) {
|
||||
|
@ -81,6 +85,7 @@ public class SeleniumRunner {
|
|||
public static void main(String[] args) {
|
||||
SeleniumRunnerParameters parms = null;
|
||||
boolean interactive = false;
|
||||
boolean success = false;
|
||||
|
||||
if ((args.length != 1) && (args.length != 2)) {
|
||||
usage("Wrong number of arguments.");
|
||||
|
@ -118,8 +123,10 @@ public class SeleniumRunner {
|
|||
System.out.println(parms);
|
||||
|
||||
SeleniumRunner runner = new SeleniumRunner(parms);
|
||||
runner.runSelectedSuites();
|
||||
success = runner.runSelectedSuites();
|
||||
}
|
||||
|
||||
System.exit(success ? 0 : -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue