Skip to content
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

Extra information for failed tests in results output #1000

Closed
abasharin opened this issue Sep 27, 2019 · 6 comments · Fixed by #1002
Labels
bug
Milestone

Comments

@abasharin
Copy link
Contributor

@abasharin abasharin commented Sep 27, 2019

Describe the bug
In addition to test results call stack is displayed for failed tests:

SQL> exec ut.run('test_betwnstr')
Between string function
Returns substring from start position to end position [.34 sec] (FAILED - 1)
Failures:
1) basic_usage
Actual: '234' (varchar2) was expected to equal: '2345' (varchar2)
00007FF8267345Eat "TEST_BETWNSTR.BASIC_USAGE", line 0
00007FF81C9685Aat "anonymous block", line 0
00007FF8267FBFCat "SYS.DBMS_SQL.EXECUTE", line 8
00007FF852BCFCat "UT3.UT_EXECUTABLE.DO_EXECUTE", line 68
00007FF852BCFCat "UT3.UT_EXECUTABLE.DO_EXECUTE", line 68
00007FF8512F9Aat "UT3.UT_EXECUTABLE_TEST.DO_EXECUTE", line 90
00007FF8512F9Aat "UT3.UT_EXECUTABLE_TEST.DO_EXECUTE", line 90
00007FF8231Aat "UT3.UT_TEST.DO_EXECUTE", line 2088
00007FF81FF207Bat "UT3.UT_SUITE_ITEM.DO_EXECUTE", line 0
00007FF852Cat "UT3.UT_SUITE.DO_EXECUTE", line 83270
00007FF82165F3Bat "UT3.UT_RUN.DO_EXECUTE", line 0
00007FF81FF207Bat "UT3.UT_SUITE_ITEM.DO_EXECUTE", line 0
00007FF8266285Cat "UT3.UT_RUNNER.RUN", line 0
00007FFat "UT3.UT.RUN_AUTONOMOUS", line 854710538
00007FFat "UT3.UT.RUN", line 854710538
00007FFat "UT3.UT.RUN", line 854710538
00007FF852F8Bat "anonymous block", line 710
Finished in .349 seconds
1 tests, 1 failed, 0 errored, 0 disabled, 0 warning(s)

Provide version info
Information about utPLSQL and Database version,

l_version: 18.0.0.0.0
l_compatibility: 12.2.0

SQL> select substr(ut.version(),1,60) as ut_version from dual;

UT_VERSION
---------------------------------------------------------------------------------
v3.1.8.3190

SQL> select banner from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production

SQL> select * from nls_session_parameters;

PARAMETER                      VALUE
------------------------------ ------------------------------
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

17 rows selected.

SQL> select substr(dbms_utility.port_string,1,60) as port_string from dual;

PORT_STRING
---------------------------------------------------------------------------------
IBMPC/WIN_NT64-9.1.0

Information about client software
SQL*Plus

Expected behavior
Expect the output to look like in 3.1.7:

SQL> select substr(ut.version(),1,60) as ut_version from dual;

UT_VERSION
--------------------------------------------------------------------------------
v3.1.7.3096

SQL> exec ut.run('test_betwnstr')
Between string function
Returns substring from start position to end position [.014 sec] (FAILED - 1)
Failures:
1) basic_usage
Actual: '234' (varchar2) was expected to equal: '2345' (varchar2)
at "TEST_BETWNSTR.BASIC_USAGE", line 5 ut.expect( betwnstr( '1234567', 2, 5 ) ).to_equal('2345');
Finished in .016 seconds
1 tests, 1 failed, 0 errored, 0 disabled, 0 warning(s)
@jgebal jgebal added this to the 3.1.9 milestone Sep 27, 2019
@jgebal jgebal added the bug label Sep 27, 2019
@jgebal

This comment has been minimized.

Copy link
Member

@jgebal jgebal commented Sep 27, 2019

Congratulations @abasharin
Your issue No. is 1000
🥇
Thanks for reporting it.

@jgebal

This comment has been minimized.

Copy link
Member

@jgebal jgebal commented Sep 27, 2019

@abasharin
Can you help me with the fix by adding this line to your test procedure TEST_BETWNSTR.BASIC_USAGE

dbms_output.put_line( dbms_utility.format_call_stack() );

Running, exec ut.run('test_betwnstr')

And providing the full output?

@abasharin

This comment has been minimized.

Copy link
Contributor Author

@abasharin abasharin commented Sep 27, 2019

Your issue No. is 1000

Yeah, I've noticed that as well. Lucky me! :)

Here is the full output.
(the test procedure, by the way, is from Getting Started documentation)

SQL> create or replace function betwnstr( a_string varchar2, a_start_pos integer, a_end_pos integer ) return varchar2
  2  is
  3  begin
  4    return substr( a_string, a_start_pos, a_end_pos - a_start_pos );
  5  end;
  6  /

Function created.

SQL> create or replace package test_betwnstr as
  2
  3    --%suite(Between string function)
  4
  5    --%test(Returns substring from start position to end position)
  6    procedure basic_usage;
  7
  8  end;
  9  /

Package created.

SQL> create or replace package body test_betwnstr as
  2
  3    procedure basic_usage is
  4    begin
  5      ut.expect( betwnstr( '1234567', 2, 5 ) ).to_equal('2345');
  6
  7      dbms_output.put_line( dbms_utility.format_call_stack() );
  8    end;
  9
 10  end;
 11  /

Package body created.

SQL> set serveroutput on
SQL> exec ut.run('test_betwnstr')
Between string function
Returns substring from start position to end position [.39 sec] (FAILED - 1)
----- PL/SQL Call Stack -----
object      line  object
handle    number  name
00007FF8547B7D30         7  package body SCOTT.TEST_BETWNSTR.BASIC_USAGE
00007FF8544B21B8         6  anonymous block
00007FF8267FBFC8      1721  package body SYS.DBMS_SQL.EXECUTE
00007FF852BCFC68       142  type body UT3.UT_EXECUTABLE.DO_EXECUTE
00007FF852BCFC68        44  type body UT3.UT_EXECUTABLE.DO_EXECUTE
00007FF8512F9A90        74  type body UT3.UT_EXECUTABLE_TEST.DO_EXECUTE
00007FF8512F9A90        38  type body UT3.UT_EXECUTABLE_TEST.DO_EXECUTE
00007FF8231A2088        79  type body UT3.UT_TEST.DO_EXECUTE
00007FF81FF207B0        49  type body UT3.UT_SUITE_ITEM.DO_EXECUTE
00007FF852C83270        66  type body UT3.UT_SUITE.DO_EXECUTE
00007FF82165F3B0        67  type body UT3.UT_RUN.DO_EXECUTE
00007FF81FF207B0        49  type body UT3.UT_SUITE_ITEM.DO_EXECUTE
00007FF8266285C0       172  package body UT3.UT_RUNNER.RUN
00007FF854710538       134  package body UT3.UT.RUN_AUTONOMOUS
00007FF854710538       488  package body UT3.UT.RUN
00007FF854710538       623  package body UT3.UT.RUN
00007FF81CFFA388         1  anonymous block
Failures:
1) basic_usage
Actual: '234' (varchar2) was expected to equal: '2345' (varchar2)
00007FF8547B7Dat "SCOTT.TEST_BETWNSTR.BASIC_USAGE", line 30
00007FF8544B21Bat "anonymous block", line 8
00007FF8267FBFCat "SYS.DBMS_SQL.EXECUTE", line 8
00007FF852BCFCat "UT3.UT_EXECUTABLE.DO_EXECUTE", line 68
00007FF852BCFCat "UT3.UT_EXECUTABLE.DO_EXECUTE", line 68
00007FF8512F9Aat "UT3.UT_EXECUTABLE_TEST.DO_EXECUTE", line 90
00007FF8512F9Aat "UT3.UT_EXECUTABLE_TEST.DO_EXECUTE", line 90
00007FF8231Aat "UT3.UT_TEST.DO_EXECUTE", line 2088
00007FF81FF207Bat "UT3.UT_SUITE_ITEM.DO_EXECUTE", line 0
00007FF852Cat "UT3.UT_SUITE.DO_EXECUTE", line 83270
00007FF82165F3Bat "UT3.UT_RUN.DO_EXECUTE", line 0
00007FF81FF207Bat "UT3.UT_SUITE_ITEM.DO_EXECUTE", line 0
00007FF8266285Cat "UT3.UT_RUNNER.RUN", line 0
00007FFat "UT3.UT.RUN_AUTONOMOUS", line 854710538
00007FFat "UT3.UT.RUN", line 854710538
00007FFat "UT3.UT.RUN", line 854710538
00007FF81CFFAat "anonymous block", line 388
Finished in .409 seconds
1 tests, 1 failed, 0 errored, 0 disabled, 0 warning(s)

PL/SQL procedure successfully completed.
@abasharin

This comment has been minimized.

Copy link
Contributor Author

@abasharin abasharin commented Sep 27, 2019

@PhilippSalvisberg, was this call stack output added to implement "Hyperlinks for code references in test details tabs (failures, errors, warnings and info)" for utPLSQL for SQL Developer v1.0.0?

By the way, line number for the failing code seems to be off:
image

@jgebal

This comment has been minimized.

Copy link
Member

@jgebal jgebal commented Sep 27, 2019

@abasharin

If you can and want to try the fix ourself, you need to change this line to be: return regexp_replace( a_stack, '^(0x)?[0-9a-f]+\s+', '', 1, 0, 'mi' );

Fix is on it's way - will be added to 3.1.9

@abasharin

This comment has been minimized.

Copy link
Contributor Author

@abasharin abasharin commented Sep 27, 2019

Perfect! Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.