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

Skip to content

Commit 718ac0d

Browse files
committed
Improved test stability.
Added human-readable reporting of tests run-time into `ut_documentation_reporter`.
1 parent 86e84c8 commit 718ac0d

2 files changed

Lines changed: 24 additions & 22 deletions

File tree

source/reporters/ut_documentation_reporter.tpb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ create or replace type body ut_documentation_reporter is
198198
begin
199199
print_failures_details(a_run);
200200
print_warnings(a_run);
201-
self.print_text('Finished in ' || a_run.execution_time || ' seconds');
201+
self.print_text('Finished in ' || ut_utils.interval_to_text(numtodsinterval(a_run.execution_time,'second')) );
202202

203203
l_summary_text :=
204204
a_run.results_count.total_count || ' tests, '

test/ut3_user/api/test_ut_run.pkb

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ create or replace package body test_ut_run is
66
gc_client_info constant varchar2(32767) := 'test client info';
77

88
g_context_test_results clob;
9+
g_timestamp timestamp;
910

1011
procedure clear_expectations is
1112
begin
@@ -1260,6 +1261,7 @@ Failures:%
12601261
begin
12611262
select * bulk collect into l_lines from table(ut3_develop.ut.run('check_context'));
12621263
g_context_test_results := ut3_tester_helper.main_helper.table_to_clob(l_lines);
1264+
g_timestamp := current_timestamp;
12631265
end;
12641266

12651267

@@ -1272,7 +1274,7 @@ Failures:%
12721274
||'%BEFORE_SUITE:SUITE_DESCRIPTION=Suite description'
12731275
||'%BEFORE_SUITE:SUITE_PACKAGE='||gc_owner||'.check_context'
12741276
||'%BEFORE_SUITE:SUITE_PATH=some.suite.path.check_context'
1275-
||'%BEFORE_SUITE:SUITE_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1277+
||'%BEFORE_SUITE:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
12761278
||'%APPLICATION_INFO:MODULE=utPLSQL'
12771279
||'%APPLICATION_INFO:ACTION=check_context'
12781280
||'%APPLICATION_INFO:CLIENT_INFO=before_suite%'
@@ -1287,14 +1289,14 @@ Failures:%
12871289
'%BEFORE_CONTEXT:CONTEXT_DESCRIPTION=context description'
12881290
||'%BEFORE_CONTEXT:CONTEXT_NAME=some_context'
12891291
||'%BEFORE_CONTEXT:CONTEXT_PATH=some.suite.path.check_context.some_context'
1290-
||'%BEFORE_CONTEXT:CONTEXT_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1292+
||'%BEFORE_CONTEXT:CONTEXT_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
12911293
||'%BEFORE_CONTEXT:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.before_context'
12921294
||'%BEFORE_CONTEXT:CURRENT_EXECUTABLE_TYPE=beforeall'
12931295
||'%BEFORE_CONTEXT:RUN_PATHS=check_context'
12941296
||'%BEFORE_CONTEXT:SUITE_DESCRIPTION=Suite description'
12951297
||'%BEFORE_CONTEXT:SUITE_PACKAGE='||gc_owner||'.check_context'
12961298
||'%BEFORE_CONTEXT:SUITE_PATH=some.suite.path.check_context'
1297-
||'%BEFORE_CONTEXT:SUITE_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1299+
||'%BEFORE_CONTEXT:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
12981300
||'%APPLICATION_INFO:MODULE=utPLSQL'
12991301
||'%APPLICATION_INFO:ACTION=check_context'
13001302
||'%APPLICATION_INFO:CLIENT_INFO=before_context%'
@@ -1308,17 +1310,17 @@ Failures:%
13081310
'%BEFORE_EACH_TEST:CONTEXT_DESCRIPTION=context description'
13091311
||'%BEFORE_EACH_TEST:CONTEXT_NAME=some_context'
13101312
||'%BEFORE_EACH_TEST:CONTEXT_PATH=some.suite.path.check_context.some_context'
1311-
||'%BEFORE_EACH_TEST:CONTEXT_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1313+
||'%BEFORE_EACH_TEST:CONTEXT_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
13121314
||'%BEFORE_EACH_TEST:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.before_each_test'
13131315
||'%BEFORE_EACH_TEST:CURRENT_EXECUTABLE_TYPE=beforeeach'
13141316
||'%BEFORE_EACH_TEST:RUN_PATHS=check_context'
13151317
||'%BEFORE_EACH_TEST:SUITE_DESCRIPTION=Suite description'
13161318
||'%BEFORE_EACH_TEST:SUITE_PACKAGE='||gc_owner||'.check_context'
13171319
||'%BEFORE_EACH_TEST:SUITE_PATH=some.suite.path.check_context'
1318-
||'%BEFORE_EACH_TEST:SUITE_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1320+
||'%BEFORE_EACH_TEST:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
13191321
||'%BEFORE_EACH_TEST:TEST_DESCRIPTION=Some test description'
13201322
||'%BEFORE_EACH_TEST:TEST_NAME='||gc_owner||'.check_context.the_test'
1321-
||'%BEFORE_EACH_TEST:TEST_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1323+
||'%BEFORE_EACH_TEST:TEST_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
13221324
||'%APPLICATION_INFO:MODULE=utPLSQL'
13231325
||'%APPLICATION_INFO:ACTION=check_context'
13241326
||'%APPLICATION_INFO:CLIENT_INFO=before_each_test%'
@@ -1331,17 +1333,17 @@ Failures:%
13311333
'%BEFORE_TEST:CONTEXT_DESCRIPTION=context description'
13321334
||'%BEFORE_TEST:CONTEXT_NAME=some_context'
13331335
||'%BEFORE_TEST:CONTEXT_PATH=some.suite.path.check_context.some_context'
1334-
||'%BEFORE_TEST:CONTEXT_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1336+
||'%BEFORE_TEST:CONTEXT_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
13351337
||'%BEFORE_TEST:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.before_test'
13361338
||'%BEFORE_TEST:CURRENT_EXECUTABLE_TYPE=beforetest'
13371339
||'%BEFORE_TEST:RUN_PATHS=check_context'
13381340
||'%BEFORE_TEST:SUITE_DESCRIPTION=Suite description'
13391341
||'%BEFORE_TEST:SUITE_PACKAGE='||gc_owner||'.check_context'
13401342
||'%BEFORE_TEST:SUITE_PATH=some.suite.path.check_context'
1341-
||'%BEFORE_TEST:SUITE_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1343+
||'%BEFORE_TEST:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
13421344
||'%BEFORE_TEST:TEST_DESCRIPTION=Some test description'
13431345
||'%BEFORE_TEST:TEST_NAME='||gc_owner||'.check_context.the_test'
1344-
||'%BEFORE_TEST:TEST_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1346+
||'%BEFORE_TEST:TEST_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
13451347
||'%APPLICATION_INFO:MODULE=utPLSQL'
13461348
||'%APPLICATION_INFO:ACTION=check_context'
13471349
||'%APPLICATION_INFO:CLIENT_INFO=before_test%'
@@ -1354,17 +1356,17 @@ Failures:%
13541356
'%THE_TEST:CONTEXT_DESCRIPTION=context description'
13551357
||'%THE_TEST:CONTEXT_NAME=some_context'
13561358
||'%THE_TEST:CONTEXT_PATH=some.suite.path.check_context.some_context'
1357-
||'%THE_TEST:CONTEXT_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1359+
||'%THE_TEST:CONTEXT_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
13581360
||'%THE_TEST:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.the_test'
13591361
||'%THE_TEST:CURRENT_EXECUTABLE_TYPE=test'
13601362
||'%THE_TEST:RUN_PATHS=check_context'
13611363
||'%THE_TEST:SUITE_DESCRIPTION=Suite description'
13621364
||'%THE_TEST:SUITE_PACKAGE='||gc_owner||'.check_context'
13631365
||'%THE_TEST:SUITE_PATH=some.suite.path.check_context'
1364-
||'%THE_TEST:SUITE_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1366+
||'%THE_TEST:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
13651367
||'%THE_TEST:TEST_DESCRIPTION=Some test description'
13661368
||'%THE_TEST:TEST_NAME='||gc_owner||'.check_context.the_test'
1367-
||'%THE_TEST:TEST_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1369+
||'%THE_TEST:TEST_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
13681370
||'%APPLICATION_INFO:MODULE=utPLSQL'
13691371
||'%APPLICATION_INFO:ACTION=check_context'
13701372
||'%APPLICATION_INFO:CLIENT_INFO=the_test%'
@@ -1377,17 +1379,17 @@ Failures:%
13771379
'%AFTER_TEST:CONTEXT_DESCRIPTION=context description'
13781380
||'%AFTER_TEST:CONTEXT_NAME=some_context'
13791381
||'%AFTER_TEST:CONTEXT_PATH=some.suite.path.check_context.some_context'
1380-
||'%AFTER_TEST:CONTEXT_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1382+
||'%AFTER_TEST:CONTEXT_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
13811383
||'%AFTER_TEST:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.after_test'
13821384
||'%AFTER_TEST:CURRENT_EXECUTABLE_TYPE=aftertest'
13831385
||'%AFTER_TEST:RUN_PATHS=check_context'
13841386
||'%AFTER_TEST:SUITE_DESCRIPTION=Suite description'
13851387
||'%AFTER_TEST:SUITE_PACKAGE='||gc_owner||'.check_context'
13861388
||'%AFTER_TEST:SUITE_PATH=some.suite.path.check_context'
1387-
||'%AFTER_TEST:SUITE_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1389+
||'%AFTER_TEST:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
13881390
||'%AFTER_TEST:TEST_DESCRIPTION=Some test description'
13891391
||'%AFTER_TEST:TEST_NAME='||gc_owner||'.check_context.the_test'
1390-
||'%AFTER_TEST:TEST_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1392+
||'%AFTER_TEST:TEST_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
13911393
||'%APPLICATION_INFO:MODULE=utPLSQL'
13921394
||'%APPLICATION_INFO:ACTION=check_context'
13931395
||'%APPLICATION_INFO:CLIENT_INFO=after_test%'
@@ -1400,17 +1402,17 @@ Failures:%
14001402
'%AFTER_EACH_TEST:CONTEXT_DESCRIPTION=context description'
14011403
||'%AFTER_EACH_TEST:CONTEXT_NAME=some_context'
14021404
||'%AFTER_EACH_TEST:CONTEXT_PATH=some.suite.path.check_context.some_context'
1403-
||'%AFTER_EACH_TEST:CONTEXT_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1405+
||'%AFTER_EACH_TEST:CONTEXT_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
14041406
||'%AFTER_EACH_TEST:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.after_each_test'
14051407
||'%AFTER_EACH_TEST:CURRENT_EXECUTABLE_TYPE=aftereach'
14061408
||'%AFTER_EACH_TEST:RUN_PATHS=check_context'
14071409
||'%AFTER_EACH_TEST:SUITE_DESCRIPTION=Suite description'
14081410
||'%AFTER_EACH_TEST:SUITE_PACKAGE='||gc_owner||'.check_context'
14091411
||'%AFTER_EACH_TEST:SUITE_PATH=some.suite.path.check_context'
1410-
||'%AFTER_EACH_TEST:SUITE_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1412+
||'%AFTER_EACH_TEST:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
14111413
||'%AFTER_EACH_TEST:TEST_DESCRIPTION=Some test description'
14121414
||'%AFTER_EACH_TEST:TEST_NAME='||gc_owner||'.check_context.the_test'
1413-
||'%AFTER_EACH_TEST:TEST_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1415+
||'%AFTER_EACH_TEST:TEST_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
14141416
||'%APPLICATION_INFO:MODULE=utPLSQL'
14151417
||'%APPLICATION_INFO:ACTION=check_context'
14161418
||'%APPLICATION_INFO:CLIENT_INFO=after_each_test%'
@@ -1423,14 +1425,14 @@ Failures:%
14231425
'%AFTER_CONTEXT:CONTEXT_DESCRIPTION=context description'
14241426
||'%AFTER_CONTEXT:CONTEXT_NAME=some_context'
14251427
||'%AFTER_CONTEXT:CONTEXT_PATH=some.suite.path.check_context.some_context'
1426-
||'%AFTER_CONTEXT:CONTEXT_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1428+
||'%AFTER_CONTEXT:CONTEXT_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
14271429
||'%AFTER_CONTEXT:CURRENT_EXECUTABLE_NAME='||gc_owner||'.check_context.after_context'
14281430
||'%AFTER_CONTEXT:CURRENT_EXECUTABLE_TYPE=afterall'
14291431
||'%AFTER_CONTEXT:RUN_PATHS=check_context'
14301432
||'%AFTER_CONTEXT:SUITE_DESCRIPTION=Suite description'
14311433
||'%AFTER_CONTEXT:SUITE_PACKAGE='||gc_owner||'.check_context'
14321434
||'%AFTER_CONTEXT:SUITE_PATH=some.suite.path.check_context'
1433-
||'%AFTER_CONTEXT:SUITE_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1435+
||'%AFTER_CONTEXT:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
14341436
||'%APPLICATION_INFO:MODULE=utPLSQL'
14351437
||'%APPLICATION_INFO:ACTION=check_context'
14361438
||'%APPLICATION_INFO:CLIENT_INFO=after_context%'
@@ -1447,7 +1449,7 @@ Failures:%
14471449
||'%AFTER_SUITE:SUITE_DESCRIPTION=Suite description'
14481450
||'%AFTER_SUITE:SUITE_PACKAGE='||gc_owner||'.check_context'
14491451
||'%AFTER_SUITE:SUITE_PATH=some.suite.path.check_context'
1450-
||'%AFTER_SUITE:SUITE_START_TIME='||to_char(current_timestamp,'syyyy-mm-dd"T"hh24:mi')
1452+
||'%AFTER_SUITE:SUITE_START_TIME='||to_char(g_timestamp,'syyyy-mm-dd"T"hh24:mi')
14511453
||'%APPLICATION_INFO:MODULE=utPLSQL'
14521454
||'%APPLICATION_INFO:ACTION=check_context'
14531455
||'%APPLICATION_INFO:CLIENT_INFO=after_suite%'

0 commit comments

Comments
 (0)