|
5 | 5 | Current limit of script parameters is 39 |
6 | 6 |
|
7 | 7 | Scrip invocation: |
8 | | - ut_run.sql user password database [ut_path|ut_paths] (-f=format [-o=output] [-s] ...) |
| 8 | + ut_run.sql user/password@database [-p=(ut_path|ut_paths)] [-f=format [-o=output] [-s] ...] |
9 | 9 |
|
10 | 10 | Parameters: |
11 | | - user - username to connect as |
12 | | - password - password of the user |
13 | | - database - database to connect to |
14 | | - ut_path - a path(s) ot unit test(s) to be executed: user[.package[.procedure]] |
15 | | - ut_paths - a comma separated list of ut_path (with no spaces in between) |
16 | | - -f=format - reporter to be used for reporting |
17 | | - -o=output - file name to save the output provided by the reporter. |
18 | | - If defined, the output is not displayed on screen by default. This can be changed with the -s parameter. |
19 | | - If not defined, then output will be displayed on screen, even if the parameter -s is not specified. |
20 | | - If more than one -o parameter is specified for one -f parameter, the last one is taken into consideration. |
21 | | - -s - Forces putting output to to screen for a given -f parameter. |
| 11 | + user - username to connect as |
| 12 | + password - password of the user |
| 13 | + database - database to connect to |
| 14 | + -p=ut_path(s)- A path or a comma separated list of paths to unit test to be executed. |
| 15 | + The path can be in one of the following formats: |
| 16 | + schema[.package[.procedure]] |
| 17 | + schema:suitepacakge[.suitepackage[.suitepackage][...]][.procedure] |
| 18 | + Both formats can be mixed in the comma separated list. |
| 19 | + If only schema is provided, then all suites owner by that schema (user) are executed. |
| 20 | + If -p is omitted, the current schema is used. |
| 21 | + -f=format - A reporter to be used for reporting. |
| 22 | + Available options: |
| 23 | + -f=ut_documentation_reporter |
| 24 | + A textual pretty-print of unit test results (usually use for console output) |
| 25 | + -f=ut_teamcity_reporter |
| 26 | + A teamcity Unit Test reporter, that can be used to visualize progress of test execution as the job progresses. |
| 27 | + -f=ut_junit_reporter |
| 28 | + A junit xml format (as defined at: http://stackoverflow.com/a/9691131 and at https://gist.github.com/kuzuha/232902acab1344d6b578) |
| 29 | + Usually used for consumption by Continuous Integration servers like Jenkins/Hudson or Teamcity |
| 30 | + If no -f option is provided, the ut_documentation_reporter will be used. |
| 31 | +
|
| 32 | + -o=output - file name to save the output provided by the reporter. |
| 33 | + If defined, the output is not displayed on screen by default. This can be changed with the -s parameter. |
| 34 | + If not defined, then output will be displayed on screen, even if the parameter -s is not specified. |
| 35 | + If more than one -o parameter is specified for one -f parameter, the last one is taken into consideration. |
| 36 | + -s - Forces putting output to to screen for a given -f parameter. |
22 | 37 |
|
23 | 38 | Parameters -f, -o, -s are correlated. That is parameters -o and -s are defining outputs for -f. |
24 | 39 | Examples of invocation using sqlplus from command line: |
25 | 40 |
|
26 | | - sqlplus /nolog @ut_run hr hr xe hr -f=ut_documentation_reporter -o=run.log -s -f=ut_teamcity_reporter -o=teamcity.xml |
| 41 | + sqlplus /nolog @ut_run hr/hr@xe -p=hr_test -f=ut_documentation_reporter -o=run.log -s -f=ut_teamcity_reporter -o=teamcity.xml |
27 | 42 |
|
28 | | - Unit tests will be be invoked with two reporters: |
29 | | - - ut_documentation_reporter - this one will output to screen and into file "run.log" |
30 | | - - ut_teamcity_reporter - this one will output to file "teamcity.xml" |
| 43 | + All Unit tests from schema "hr_test" will be be invoked with two reporters: |
| 44 | + - ut_documentation_reporter - will output to screen and save it's output to file "run.log" |
| 45 | + - ut_teamcity_reporter - will save it's output to file "teamcity.xml" |
31 | 46 |
|
32 | | - sqlplus /nolog @ut_run hr hr xe hr -f=ut_documentation_reporter |
| 47 | + sqlplus /nolog @ut_run hr/hr@xe |
33 | 48 |
|
34 | | - Unit tests will be be invoked with ut_documentation_reporter as a format and the results will be printed to screen |
| 49 | + All Unit tests from schema "hr" will be be invoked with ut_documentation_reporter as a format and the results will be printed to screen |
35 | 50 |
|
36 | 51 | */ |
37 | 52 |
|
38 | 53 | whenever sqlerror exit failure |
39 | 54 | whenever oserror exit failure |
40 | | -conn &1/&2@&3 |
| 55 | +conn &1 |
41 | 56 | whenever sqlerror continue |
42 | 57 | whenever oserror continue |
43 | 58 |
|
@@ -106,15 +121,15 @@ begin |
106 | 121 | p( 'set linesize 4000'); |
107 | 122 | p( 'spool ut_run.dbms_output.log'); |
108 | 123 | p( 'declare'); |
109 | | - p( ' v_reporter ut_reporter;'); |
110 | | - p( ' v_reporters_list ut_reporters_list := ut_reporters_list();'); |
| 124 | + p( ' v_reporter ut_reporter_base;'); |
| 125 | + p( ' v_reporters_list ut_reporters := ut_reporters();'); |
111 | 126 | p( 'begin'); |
112 | 127 | for i in 1 .. cardinality(l_run_params.call_params) loop |
113 | 128 | p(' v_reporter := '||l_run_params.call_params(i).ut_reporter_name||'('||l_output_type||'());'); |
114 | 129 | p(' v_reporter.output.output_id := '''||l_run_params.call_params(i).output_id||''';'); |
115 | 130 | p(' v_reporters_list.extend; v_reporters_list(v_reporters_list.last) := v_reporter;'); |
116 | 131 | end loop; |
117 | | - p( ' ut.run( ut_varchar2_list('||l_run_params.ut_paths||'), ut_composite_reporter( v_reporters_list ) );'); |
| 132 | + p( ' ut_runner.run( ut_varchar2_list('||l_run_params.ut_paths||'), v_reporters_list );'); |
118 | 133 | p( 'end;'); |
119 | 134 | p( '/'); |
120 | 135 | p( 'spool off'); |
@@ -149,9 +164,9 @@ spool off |
149 | 164 | set termout off |
150 | 165 | set define # |
151 | 166 | --try running on windows |
152 | | -$ start sqlplus ##1/##2@##3 @run_in_backgroung.sql.tmp |
| 167 | +$ start sqlplus ##1 @run_in_backgroung.sql.tmp |
153 | 168 | --try running on linus/unix |
154 | | -! sqlplus ##1/##2@##3 @run_in_backgroung.sql.tmp & |
| 169 | +! sqlplus ##1 @run_in_backgroung.sql.tmp & |
155 | 170 | set define & |
156 | 171 | set termout on |
157 | 172 | --make sure we fetch row by row to indicate the progress |
|
0 commit comments