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

Asserts in SubVIs not appearing as expected in JUnit reports #104

Closed
ChrisStrykesAgain opened this issue Nov 3, 2020 · 6 comments
Closed

Comments

@ChrisStrykesAgain
Copy link
Contributor

ChrisStrykesAgain commented Nov 3, 2020

When calling an assert in a SubVI, JUnit reports aren't generated in the manner I expect.

For example, consider the following:

image

The text based output is as follows:

11/3/2020 3:02:39 PM - PASS - Calling Top Level VI (Incorrect) - Calling Non Working SubVI.vi
11/3/2020 3:02:39 PM - FAIL - Top Level VI (Correct) - Calling Working SubVI.vi
11/3/2020 3:02:39 PM - FAIL -   This is a working test in a SubVI - Working SubVI Test.vi
11/3/2020 3:02:39 PM - FAIL -     SubVI Assert True
11/3/2020 3:02:40 PM - FAIL - My Test That Works Correctly - Correct Test.vi
11/3/2020 3:02:40 PM - FAIL -   Assert something is true

Here you can see the three top level VIs.

  • Calling Top Level VI (Incorrect) has an assert in a subVI, but the subVI itself is not defined as a test. I'm fine with this not working.
  • Top Level VI (Correct) behaves as I would expect. I defined a test in the SubVI, and it is traceable back up to the top level.
  • My Test That Works Correctly is a self-contained test, included only for reference.

The JUnit output. however, is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="This is a working test in a SubVI" errors="0" skipped="1" tests="1" failures="0" timestamp="2020-11-03T15:02:39">
  <testcase classname="This is a working test in a SubVI" name="SubVI Assert True">
    <failure message="test failure">"FAIL"</failure>
  </testcase>
</testsuite>
<testsuite name="My Test That Works Correctly" errors="0" skipped="1" tests="1" failures="0" timestamp="2020-11-03T15:02:40">
<testcase classname="My Test That Works Correctly" name="Assert something is true">
  <failure message="test failure">"FAIL"</failure>
</testcase>
</testsuite>
</testsuites>

The problem is that Top Level VI (Correct) never appears. If you're using the same SubVI from multiple top level tests, this is a distinct problem.

Reproducing code is attached (saved in 2020... sorry)

This might be a duplicate of or related to #100 but I'm not sure.

Caraya JUnit Bug.zip

@ChrisStrykesAgain
Copy link
Contributor Author

For reference, I found a quick fix that works for my immediate needs, but could definitely be improved upon.

Modification is to Caraya.lvlib:Test Report.JUnit.lvclass:Test To Report Entry.vi.

Original:

image

Modified:

image

@francois-normandin
Copy link
Collaborator

Will make it to the next release. Thanks @ChrisStrykesAgain
I might ask you to test the package before I make it public... I'll be in touch.

@ChrisStrykesAgain
Copy link
Contributor Author

Sure thing. Happy to clone and test against an unpackaged version as well, if that would be more convenient.

@francois-normandin
Copy link
Collaborator

francois-normandin commented Nov 11, 2020 via email

@francois-normandin
Copy link
Collaborator

Available in VIP file (pre-release 1.1.0)

https://github.com/JKISoftware/Caraya/releases/tag/1.1.0

@ChrisStrykesAgain
Copy link
Contributor Author

I like it! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants