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
|
* Parse each of the output files from the test suites, and create a unified
|
||||||
* output file.
|
* output file.
|
||||||
*/
|
*/
|
||||||
public void summarizeOutput() {
|
public Status summarizeOutput() {
|
||||||
LogStats log = LogStats.parse(parms.getLogFile());
|
LogStats log = LogStats.parse(parms.getLogFile());
|
||||||
|
|
||||||
List<SuiteStats> suites = new ArrayList<SuiteStats>();
|
List<SuiteStats> suites = new ArrayList<SuiteStats>();
|
||||||
|
@ -71,6 +71,7 @@ public class OutputManager {
|
||||||
|
|
||||||
OutputSummaryFormatter formatter = new OutputSummaryFormatter(parms);
|
OutputSummaryFormatter formatter = new OutputSummaryFormatter(parms);
|
||||||
formatter.format(log, suites);
|
formatter.format(log, suites);
|
||||||
|
return formatter.figureOverallStatus(log, suites);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class HtmlFileFilter implements FileFilter {
|
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.
|
* 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()) {
|
if (log.hasErrors()) {
|
||||||
return Status.ERROR;
|
return Status.ERROR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,8 @@ public class SeleniumRunner {
|
||||||
this.outputManager = new OutputManager(parms);
|
this.outputManager = new OutputManager(parms);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runSelectedSuites() {
|
public boolean runSelectedSuites() {
|
||||||
|
boolean success;
|
||||||
try {
|
try {
|
||||||
listener.runStarted();
|
listener.runStarted();
|
||||||
outputManager.cleanOutputDirectory();
|
outputManager.cleanOutputDirectory();
|
||||||
|
@ -52,15 +53,18 @@ public class SeleniumRunner {
|
||||||
listener.suiteStopped(suiteDir);
|
listener.suiteStopped(suiteDir);
|
||||||
}
|
}
|
||||||
listener.runEndTime();
|
listener.runEndTime();
|
||||||
outputManager.summarizeOutput();
|
success = true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
listener.runFailed(e);
|
listener.runFailed(e);
|
||||||
|
success = false;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (FatalException e) {
|
} catch (FatalException e) {
|
||||||
listener.runFailed(e);
|
listener.runFailed(e);
|
||||||
|
success = false;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
listener.runStopped();
|
listener.runStopped();
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void selectAllSuites(SeleniumRunnerParameters parms) {
|
private static void selectAllSuites(SeleniumRunnerParameters parms) {
|
||||||
|
@ -81,6 +85,7 @@ public class SeleniumRunner {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SeleniumRunnerParameters parms = null;
|
SeleniumRunnerParameters parms = null;
|
||||||
boolean interactive = false;
|
boolean interactive = false;
|
||||||
|
boolean success = false;
|
||||||
|
|
||||||
if ((args.length != 1) && (args.length != 2)) {
|
if ((args.length != 1) && (args.length != 2)) {
|
||||||
usage("Wrong number of arguments.");
|
usage("Wrong number of arguments.");
|
||||||
|
@ -118,8 +123,10 @@ public class SeleniumRunner {
|
||||||
System.out.println(parms);
|
System.out.println(parms);
|
||||||
|
|
||||||
SeleniumRunner runner = new SeleniumRunner(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