Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change the failure error code parameter
  • Loading branch information
viniciusam committed Jul 21, 2017
commit 349cc53a68679af3c437dad63e831e6885bcea03
86 changes: 43 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,49 +20,49 @@ You can download development versions on [Bintray](https://bintray.com/viniciusa
utplsql run user/pass@[[host][:port]/]db [-p=(ut_path|ut_paths)] [-f=format [-o=output_file] [-s] ...]

```
user - Username to connect as.
password - Password of the user.
host - Server address, defaults to 127.0.0.1.
port - Server port, defaults to 1521.
db - Database to connect to.
-p=suite_path(s) - A suite path or a comma separated list of suite paths for unit test to be executed.
The path(s) can be in one of the following formats:
schema[.package[.procedure]]
schema:suite[.suite[.suite][...]][.procedure]
Both formats can be mixed in the list.
If only schema is provided, then all suites owner by that schema are executed.
If -p is omitted, the current schema is used.
-f=format - A reporter to be used for reporting.
If no -f option is provided, the default ut_documentation_reporter is used.
Available options:
-f=ut_documentation_reporter
A textual pretty-print of unit test results (usually use for console output)
-f=ut_teamcity_reporter
For reporting live progress of test execution with Teamcity CI.
-f=ut_xunit_reporter
Used for reporting test results with CI servers like Jenkins/Hudson/Teamcity.
-f=ut_coverage_html_reporter
Generates a HTML coverage report with summary and line by line information on code coverage.
Based on open-source simplecov-html coverage reporter for Ruby.
Includes source code in the report.
-f=ut_coveralls_reporter
Generates a JSON coverage report providing information on code coverage with line numbers.
Designed for [Coveralls](https://coveralls.io/).
-f=ut_coverage_sonar_reporter
Generates a JSON coverage report providing information on code coverage with line numbers.
Designed for [SonarQube](https://about.sonarqube.com/) to report coverage.
-f=ut_sonar_test_reporter
Generates a JSON report providing detailed information on test execution.
Designed for [SonarQube](https://about.sonarqube.com/) to report test execution.

-o=output - Defines file name to save the output from the specified reporter.
If defined, the output is not displayed on screen by default. This can be changed with the -s parameter.
If not defined, then output will be displayed on screen, even if the parameter -s is not specified.
If more than one -o parameter is specified for one -f parameter, the last one is taken into consideration.
-s - Forces putting output to to screen for a given -f parameter.
-c - If specified, enables printing of test results in colors as defined by ANSICONSOLE standards.
Works only on reporeters that support colors (ut_documentation_reporter).
--no-failure - By default, the client will exit with -1 if any test failed, override this behavior by providing this option.
user - Username to connect as.
password - Password of the user.
host - Server address, defaults to 127.0.0.1.
port - Server port, defaults to 1521.
db - Database to connect to.
-p=suite_path(s) - A suite path or a comma separated list of suite paths for unit test to be executed.
The path(s) can be in one of the following formats:
schema[.package[.procedure]]
schema:suite[.suite[.suite][...]][.procedure]
Both formats can be mixed in the list.
If only schema is provided, then all suites owner by that schema are executed.
If -p is omitted, the current schema is used.
-f=format - A reporter to be used for reporting.
If no -f option is provided, the default ut_documentation_reporter is used.
Available options:
-f=ut_documentation_reporter
A textual pretty-print of unit test results (usually use for console output)
-f=ut_teamcity_reporter
For reporting live progress of test execution with Teamcity CI.
-f=ut_xunit_reporter
Used for reporting test results with CI servers like Jenkins/Hudson/Teamcity.
-f=ut_coverage_html_reporter
Generates a HTML coverage report with summary and line by line information on code coverage.
Based on open-source simplecov-html coverage reporter for Ruby.
Includes source code in the report.
-f=ut_coveralls_reporter
Generates a JSON coverage report providing information on code coverage with line numbers.
Designed for [Coveralls](https://coveralls.io/).
-f=ut_coverage_sonar_reporter
Generates a JSON coverage report providing information on code coverage with line numbers.
Designed for [SonarQube](https://about.sonarqube.com/) to report coverage.
-f=ut_sonar_test_reporter
Generates a JSON report providing detailed information on test execution.
Designed for [SonarQube](https://about.sonarqube.com/) to report test execution.
-o=output - Defines file name to save the output from the specified reporter.
If defined, the output is not displayed on screen by default. This can be changed with the -s parameter.
If not defined, then output will be displayed on screen, even if the parameter -s is not specified.
If more than one -o parameter is specified for one -f parameter, the last one is taken into consideration.
-s - Forces putting output to to screen for a given -f parameter.
-c - If specified, enables printing of test results in colors as defined by ANSICONSOLE standards.
Works only on reporeters that support colors (ut_documentation_reporter).
--failure-exit-code - Override the exit code on failure, defaults to 1. You can set it to 0 to always exit with a success status.
```

Parameters -f, -o, -s are correlated. That is parameters -o and -s are controlling outputs for reporter specified by the preceding -f parameter.
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/io/github/utplsql/cli/RunCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public class RunCommand {
private boolean colorConsole = false;

@Parameter(
names = {"--no-failure"},
description = "will exit with 0 even if tests failed, default false")
private boolean noFailure = false;
names = {"--failure-exit-code"},
description = "override the exit code on failure, default = 1")
private int failureExitCode = 1;

@Parameter(names = {"-source_path"}, description = "path to project source files")
private String sourcePath;
Expand Down Expand Up @@ -145,10 +145,10 @@ public int run() throws Exception {
.withSourceFiles(sourceFiles)
.withTestFiles(testFiles)
.colorConsole(this.colorConsole)
.failOnErrors(!this.noFailure)
.failOnErrors(true)
.run(conn);
} catch (SomeTestsFailedException e) {
returnCode[0] = -1;
returnCode[0] = this.failureExitCode;
} catch (SQLException e) {
// TODO
e.printStackTrace();
Expand Down