Skip to content

JUnitReporter does not report failed test results when the test case throws an exception #1072

Open

Description

@StJabin

Information about utPLSQL and Database version:
DB Version: 12.2.0.1.0
UT Version: v3.1.6.2735

JUnitReporter is activated and jenkins job is used to run multiple test cases.

If a test case fails, JUnitReporter reports the exception stack in the logfile. But all failed test statements (ut.expect...) are not part of the reporter file. That makes it difficult to analyze the problem.

If you run the same test case from HORA the exception stack is reported and all failed test statements, like:

"ORA-06512: at "METI2TDS.TSTUTGLOSQLGLO", line 376
ORA-06512: at line 6
Actual: 4 (number) was expected to equal: 5 (number)
at "METI2TDS.TSTUTGLOSQLGLO.TESTGLOSQL3", line 373"

In JUnitReporter just the first two lines are visible.

Activity

  1. lwasylow commented on May 22, 2020

    @lwasylow
    Member

    Hi @StJabin
    Did that issue occure in utPLSQL v3.10 ?
    This is quite old version and lot of fixes has been done in between.
    Also if it does.
    Could you provide a test case to replicate.

  2. StJabin commented on May 28, 2020

    @StJabin
    Author

    Hi Iwasylow, thanks for replying!

    I've repeated the test with UTPLSQL v3.1.10.3349. It shows the same behavior.

    This is the test case:

    PROCEDURE raiseExc
    IS
    v NUMBER;
    BEGIN
    ut.expect(1).to_equal(0);
    v := 3 / 0;
    END;

    Output when I use default reporter (ut_documentation_reporter):
    Failures:

    1. raiseexc
      ORA-01476: divisor is equal to zero
      ORA-06512: at "METI2TDS.TSTUTOPSFINISHPES", line 1129
      ORA-06512: at "METI2TDS.TSTUTOPSFINISHPES", line 1129
      ORA-06512: at line 6
      Actual: 1 (number) was expected to equal: 0 (number)
      at "METI2TDS.TSTUTOPSFINISHPES.RAISEEXC", line 1128 ut.expect(1).to_equal(0);

    Output when I use ut_junit_reporter:

    <error>
    <![CDATA[
    ORA-01476: divisor is equal to zero
    ORA-06512: at "METI2TDS.TSTUTOPSFINISHPES", line 1129
    ORA-06512: at "METI2TDS.TSTUTOPSFINISHPES", line 1129
    ORA-06512: at line 6
    ]]>
    </error>
    
    

    Thanks, if you can have a look on it!

  3. jgebal commented on Jun 15, 2020

    @jgebal
    Member

    Seems that error/failure reporting in JUnit reporter are mutually exclusive today.
    That could be changed and we could report both.
    Need to check if there are no restrictions on this from the format standard perspective.

  4. lwasylow commented on Feb 8, 2022

    @lwasylow
    Member

    So looking onto the specification for TFS:

    <xs:documentation xml:lang="en">The total number of tests in the suite that failed. A failure is a test which the code has explicitly failed by using the mechanisms for that purpose. e.g., via an assertEquals</xs:documentation>
    

    I believe its same valid for Junit.

    I think its question between usability and conforming to format.
    I think the case presented with division by zero is not really a valid test procedure.

    For any other exceptions that we can anticipate we can use throws or as part of the test

    EXCEPTION WHEN OTHERS THEN
      ut.fail('Message'|| SQLERRM
    

    Something between these lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions