-
Notifications
You must be signed in to change notification settings - Fork 186
UTPLSQL Tests Taking Long Time to Execute and Generate Coverage Report #1101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
How long does the "procedure under test" run usually, outside of a test situation? |
Approximately 15-20 minutes |
25% overhead doesn't sound incredibly much to me. |
I'm Sorry, I overlooked the sentence |
How many lines of code is there in the entire schema? |
|
Code to be TestedHere's a small test I've created. There is also a variant with dummy procedures to get a package body with 5000 lines of code. It's attached. However, the execution times are very similar. Please note that there are no SQL calls in this code. That's intended. The idea is to show the overhead of the profiler when running such code. create or replace package fibonacci is
function last_number (a_max_value integer) return integer;
function total_numbers (a_max_value integer) return integer;
end;
/
create or replace package body fibonacci is
function last_number (a_max_value in integer) return integer is
l_current integer := 0;
l_prev integer := 1;
l_prev_prev integer := 0;
begin
while l_prev_prev + l_prev <= a_max_value loop
l_current := l_prev_prev + l_prev;
l_prev_prev := l_prev;
l_prev := l_current;
end loop;
return l_current;
end last_number;
function total_numbers (a_max_value integer) return integer is
l_total integer := 0;
begin
for i in 1..a_max_value loop
if ( last_number(i) = i ) then
l_total := l_total + 1;
end if;
end loop;
return l_total;
end total_numbers;
end fibonacci;
/ Test CodeHere's the test code. The first one runs fast (a few millis), the second one is slow (several seconds).
Run Test in SQLclI run the following code in SQLcl set serveroutput on size unlimited
execute ut.run('test_fibonacci'); and the output was
Run Test in SQLDevI run the same test in SQLDev using the utPLSQL extension. Here's the screenshot of the test runner. It is slightly slower due to the overhead in the GUI. That's expected. Run Test in SQLDEv with Code CoverageNow the same test in SQLDev with Code Coverage. Here's the screenshot of the test runner. And here's the screenshot of the Code Coverage report shown in the browser. You see there are a lot of executions reported. It's expected that this additional book keeping takes some time. So the question is it the utPLSQL framework or is it the Oracle Database that is the main contributor? Run Test in SQLcl with
|
@PriyankaKeer Hope this helps. |
Thanks a lot @PhilippSalvisberg for debugging the issue. Yes the PLSQL code is little complex from our side , and I completely understand the scenario. |
Thanks @jgebal |
@PriyankaKeer The latest lease is 3.1.10- see releases page for details of changes/fixes/improvements in each release. Jacek |
Yes @jgebal , I was referring to UTPLSQL CLI Thanks for the info! Will try to update UTPLSQL Version used in SQL Dev and will try. |
Just to be clear. We recommend to install the newest version from here: https://github.com/utPLSQL/utPLSQL/releases . |
@PhilippSalvisberg Sure..Will try the latest version. Thanks a lot for the prompt response and suggestions. |
Describe the bug
As we would like to integrate our testcases in CICD, we are stuck in this testcases high execution time and long time to generate coverage report issue.
Provide version info
Information about utPLSQL and Database version:
UTPLSQL Version--v3.1.7.3096
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
PL/SQL Release 12.1.0.2.0 - Production
"CORE 12.1.0.2.0 Production"
TNS for Linux: Version 12.1.0.2.0 - Production
NLSRTL Version 12.1.0.2.0 - Production
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
x86_64/Linux 2.4.xx
Information about client software
SQLDeveloper
To Reproduce
Steps to reproduce the behavior:
exec ut.run('unit_test_schema', ut_coverage_html_reporter(), a_coverage_schemes => ut_varchar2_list('user_schema'));
Expected behavior
Testcases Execution time and coverage report generation time is expected to be less(and should not exceed more than 5 minutes)
Example code
If applicable, add sample code to help explain your problem.
Please avoid putting your company private/protected code in an issue, as it might violate your company's privacy and security policies:
Additional context
We observed that the execution time for the test cases written for less complex procedures(containing 30-50 lines of code) is taking less time to execute. Only the execution time for the testcases written for complex procedures is taking a lot of time.
The text was updated successfully, but these errors were encountered: