byte-physics / igortest

Igor Pro Universal Testing Framework
https://docs.byte-physics.de/igor-unit-testing-framework/
BSD 3-Clause "New" or "Revised" License
7 stars 2 forks source link

WARN is treated as error in JUNIT #437

Closed t-b closed 1 year ago

t-b commented 1 year ago

Version: 1609a0c8 (Merge pull request #435 from byte-physics/mb/fix/412-after-file-open-hook, 2023-03-16)

#include "igortest"

Function Testme()

    WARN(0)
End

gives in IP

•runtest("Procedure", enableJU= 1)
  Start of test "Unnamed"
  Entering test suite "Procedure"
  Entering test case "Testme"
  0: is false. Assertion "WARN(0)" failed in Testme (Procedure, line 8)
  Leaving test case "Testme"
  Finished with no errors
  Leaving test suite "Procedure"
  Test finished with no errors
    ▶ Assertion "WARN(0)" failed in Testme (Procedure, line 8)
  End of test "Unnamed"

but in JUNIT

<?xml version="1.0" encoding="utf-8"?>
<testsuites>
    <testsuite package="Procedure" id="0" name="Procedure" timestamp="2023-03-17T11:07:12" hostname="WIN10-THOMAS-PC" tests="1" failures="0" errors="0" skipped="0" time="0.009">
        <properties>
...
        <testcase name="Testme in Procedure (0)" classname="Testme" time="0.004">
            <error message="0: is false. Assertion &quot;WARN(0)&quot; failed in Testme (Procedure, line 8)" type="FAIL">
            </error>
        <system-out>0: is false. Assertion &quot;WARN(0)&quot; failed in Testme (Procedure, line 8)
</system-out>
        <system-err>0: is false. Assertion &quot;WARN(0)&quot; failed in Testme (Procedure, line 8)
</system-err>
        </testcase>
        <system-out>0: is false. Assertion &quot;WARN(0)&quot; failed in Testme (Procedure, line 8)
</system-out>
        <system-err>0: is false. Assertion &quot;WARN(0)&quot; failed in Testme (Procedure, line 8)
</system-err>
    </testsuite>
</testsuites>

This was not the case in previous versions.

Fix needs a test as well obviously.

t-b commented 1 year ago

The obvious test is to have a WARN(0) in one of the tests and let our usual JUNIT verification do its job.

Garados007 commented 1 year ago

WARN(0) is written to root:Packages:igortest:TestAssertionResult as FAIL (the same like CHECK(0)) which is returned in JUnit as it is. I think there is a need to add a new column for the severity (with the values WARN and ERROR) to allow filtering in the JUnit output. I won't drop it from data collection at all as there might be a future use case for it and we have to reimplement this again. Implementing the severity column wouldn't take long.

I would omit all WARN assertions from JUnit as it doesn't have support for warnings (it would still be included in stdout and stderr).

I will tackle this issue next monday as I think I have enough todo with WM tests for today.

t-b commented 1 year ago

Sounds good! (analysis and time plan)

Garados007 commented 1 year ago

Thinking about this, I can also add a different value WARN to the TYPE column (FAIL and ERROR would be the other possible values). Doing this I won't need to add a new column.

t-b commented 1 year ago

I think the new column is a good idea, as it makes debugging/testing easier.