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

Skip to content

Commit fa50762

Browse files
authored
Merge pull request #141 from jgebal/feature/base_objects_refactoring
Refactoring of unit test base classes.
2 parents fcfae1e + d6c4ebb commit fa50762

237 files changed

Lines changed: 2375 additions & 3044 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
- UT3_PASSWORD=ut3
2020
- UT3_TABLESPACE=users
2121
# Target Branch and Directory for Deployment of Docs
22-
- PAGES_TARGET_BRANCH="gh-pages"
22+
- PAGES_TARGET_BRANCH="gh-pages"
2323
- PAGES_VERSION_BASE="version3"
2424

2525
addons:
@@ -31,8 +31,8 @@ addons:
3131
- unzip
3232

3333

34-
cache:
35-
directories:
34+
cache:
35+
directories:
3636
- .cache
3737
- $HOME/.cache
3838

@@ -43,17 +43,17 @@ before_install:
4343
- test -f "$ORACLE_ZIP_DIR"/$(basename $ORACLE_FILE) || bash .travis/oracle/download.sh
4444

4545
install:
46-
- sudo pip install -r .travis/python_req.txt
46+
- sudo pip install -r .travis/python_req.txt
4747
- bash .travis/oracle/install.sh
48-
48+
4949
script:
5050
- bash .travis/create_utplsql_user.sh
5151
- bash .travis/install_libraries.sh
5252
- bash .travis/install.sh
5353
- bash .travis/run_examples.sh
5454
- bash .travis/run_test.sh
55-
- bash .travis/build_docs.sh
56-
- bash .travis/push_docs_to_gh_pages.sh
55+
# - bash .travis/build_docs.sh
56+
# - bash .travis/push_docs_to_gh_pages.sh
5757

5858
notifications:
5959
slack: utplsql:oiMuXO95TvKeAUENuDt4cPrB

.travis/install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ cd ..
1111
cd build
1212
#do style check
1313
"$ORACLE_HOME/bin/sqlplus" $UT3_USER/$UT3_PASSWORD @utplsql_style_check.sql
14+
15+
#enable plsql debug
16+
#"$ORACLE_HOME/bin/sqlplus" $UT3_USER/$UT3_PASSWORD @ut_debug_enable.sql
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ alter session set PLSQL_CCFlags = 'ut_trace:true';
77
alter package ut_annotations compile debug package;
88
alter package ut_suite_manager compile debug package;
99
alter package ut_utils compile debug package;
10+
exit

client_source/sqlplus/ut_run.sql

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,54 @@
55
Current limit of script parameters is 39
66
77
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] ...]
99
1010
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.
2237
2338
Parameters -f, -o, -s are correlated. That is parameters -o and -s are defining outputs for -f.
2439
Examples of invocation using sqlplus from command line:
2540
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
2742
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"
3146
32-
sqlplus /nolog @ut_run hr hr xe hr -f=ut_documentation_reporter
47+
sqlplus /nolog @ut_run hr/hr@xe
3348
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
3550
3651
*/
3752

3853
whenever sqlerror exit failure
3954
whenever oserror exit failure
40-
conn &1/&2@&3
55+
conn &1
4156
whenever sqlerror continue
4257
whenever oserror continue
4358

@@ -106,15 +121,15 @@ begin
106121
p( 'set linesize 4000');
107122
p( 'spool ut_run.dbms_output.log');
108123
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();');
111126
p( 'begin');
112127
for i in 1 .. cardinality(l_run_params.call_params) loop
113128
p(' v_reporter := '||l_run_params.call_params(i).ut_reporter_name||'('||l_output_type||'());');
114129
p(' v_reporter.output.output_id := '''||l_run_params.call_params(i).output_id||''';');
115130
p(' v_reporters_list.extend; v_reporters_list(v_reporters_list.last) := v_reporter;');
116131
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 );');
118133
p( 'end;');
119134
p( '/');
120135
p( 'spool off');
@@ -149,9 +164,9 @@ spool off
149164
set termout off
150165
set define #
151166
--try running on windows
152-
$ start sqlplus ##1/##2@##3 @run_in_backgroung.sql.tmp
167+
$ start sqlplus ##1 @run_in_backgroung.sql.tmp
153168
--try running on linus/unix
154-
! sqlplus ##1/##2@##3 @run_in_backgroung.sql.tmp &
169+
! sqlplus ##1 @run_in_backgroung.sql.tmp &
155170
set define &
156171
set termout on
157172
--make sure we fetch row by row to indicate the progress

examples/RunAllExamples.sql

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ Clear Screen
33
set echo off
44
set feedback off
55
set linesize 1000
6-
prompt RunExampleComplexSuiteWithCustomDBMSOutputReporter
7-
@@RunExampleComplexSuiteWithCustomDBMSOutputReporter.sql
6+
7+
--developer examples
8+
prompt RunExampleComplexSuiteWithCustomReporter
9+
@@developer_examples/RunExampleComplexSuiteWithCustomReporter.sql
10+
prompt RunExampleTestSuiteWithCustomReporter
11+
@@developer_examples/RunExampleTestSuiteWithCustomReporter.sql
12+
prompt RunExampleTestAnnotationsParsingTimeHugePackage
13+
@@developer_examples/RunExampleTestAnnotationsParsingTimeHugePackage.sql
814
prompt RunExampleTestSuite
9-
@@RunExampleTestSuite.sql
10-
prompt RunExampleTestSuiteWithCustomDBMSOutputReporter
11-
@@RunExampleTestSuiteWithCustomDBMSOutputReporter.sql
12-
prompt RunExampleTestSuiteWithDBMSOutputReporter
13-
@@RunExampleTestSuiteWithDBMSOutputReporter.sql
14-
prompt RunExampleTestThroughBaseClass
15-
@@RunExampleTestThroughBaseClass.sql
15+
@@developer_examples/RunExampleTestSuite.sql
1616
prompt RunExampleTestSuiteWithCompositeReporter
17-
@@RunExampleTestSuiteWithCompositeReporter.sql
17+
@@developer_examples/RunExampleTestSuiteWithCompositeReporter.sql
18+
19+
1820
prompt RunExampleTestAnnotationBasedForCurrentSchema
1921
@@RunExampleTestAnnotationBasedForCurrentSchema.sql
20-
prompt RunExampleTestAnnotationsHugePackage
21-
@@RunExampleTestAnnotationsHugePackage.sql
2222
prompt RunExpectations
2323
@@RunExpectations.sql
2424

@@ -27,3 +27,4 @@ prompt RunExpectations
2727
@@award_bonus/run_award_bonus_test.sql
2828
@@between_string/run_betwnstr_test.sql
2929
@@remove_rooms_by_name/run_remove_rooms_by_name_test.sql
30+
@@demo_of_expectations/run.sql

examples/RunExampleComplexSuiteWithCustomDBMSOutputReporter.sql

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
--Shows how to create a test suite with the default reporter which is dbms_output
2-
--No tables are used for this.
3-
--Suite Management packages are when developed will make this easier.
41
--Clear Screen
52
Set Serveroutput On Size Unlimited format truncated
63
set echo off
74
--install the example unit test packages
85
@@test_pkg1.pck
96
@@test_pkg2.pck
10-
@@ut_custom_reporter.tps
11-
@@ut_custom_reporter.tpb
127

138
begin
14-
ut.run(user, ut_custom_reporter(a_tab_size => 2));
9+
ut_runner.run();
1510
end;
1611
/
1712

18-
drop type ut_custom_reporter;
1913
drop package test_pkg1;
2014
drop package test_pkg2;

examples/RunExampleTestSuite.sql

Lines changed: 0 additions & 54 deletions
This file was deleted.

examples/RunExampleTestSuiteWithCompositeReporter.sql

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)