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

Adding unit tests from with a unit test not a supported pattern #577

Closed
skliper opened this issue Aug 24, 2020 · 7 comments · Fixed by #751 or #767
Closed

Adding unit tests from with a unit test not a supported pattern #577

skliper opened this issue Aug 24, 2020 · 7 comments · Fixed by #751 or #767
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Aug 24, 2020

Describe the bug
Possibly related to #554 (reverted to v5.1.0-rc1 and they ran). Adding tests after starting to run tests (adding a test within a test) is not a supported pattern, and they won't actually get run (they do get added to the front of the individual list, but the merged test list doesn't not handle them).

To Reproduce
Add a unit test from within a unit test, build/execute and the added unit test will not execute.

Expected behavior
Didn't know NOT to do this... just don't do it.

Resolution
Just don't do it.
Document limitations and proper usage.

Code snips
uttest.c - see the adding and merging

System observed on:

  • Hardware: cFS Dev Server
  • OS: Ubuntu 18.04
  • Versions checked latest integration candidate and v5.1.0-rc1, problem does not exist in v5.1.0-rc1

Additional context
#554

Reporter Info
Jacob Hageman - NASA/GSFC

@jphickey
Copy link
Contributor

I just checked for SB in the main branch and they seem to work there....

@skliper
Copy link
Contributor Author

skliper commented Aug 25, 2020

Looks like it's not due to #554. Try the bundle integration-candidate, the sb subtests don't look like they execute.

EDIT - I'm mistake here... they do execute in 'sb'

@skliper
Copy link
Contributor Author

skliper commented Aug 25, 2020

Starting to look like nasa/cFE#726 may have broken it... still digging in.

@skliper
Copy link
Contributor Author

skliper commented Aug 25, 2020

Looks like ut_assert now silently fails to add a test from inside another test. This worked pre #554. sb didn't do this, but msg did.

@skliper
Copy link
Contributor Author

skliper commented Aug 25, 2020

Or I should probably say doesn't add the test in a way that it will get executed, since it gets added to the front of the list (at least that's what it looks like on quick inspection.)

@jphickey
Copy link
Contributor

Ahh yes, that would explain it - because that happens after combining the setup+test+teardown lists into one summary list, the newly-added test is still sitting on one of the component lists, not the summary list.

If this is a desired/necessary feature (to add tests during tests) then perhaps we can add an outer loop into UtTest_Run to pick up tests that been added during the run. Would be simple to add.

@skliper skliper removed the wontfix label Nov 5, 2020
@skliper
Copy link
Contributor Author

skliper commented Dec 29, 2020

@astrogeco - can we close this? No requirement or real use case identified... just don't add test cases from other test cases. No need to implement additional logic simply to add complexity.

At minimum reclassify as not a bug, since it's just not a supported capability. Nothing is broken.

skliper added a commit to skliper/osal that referenced this issue Jan 11, 2021
@skliper skliper added this to the 6.0.0 milestone Jan 11, 2021
astrogeco added a commit that referenced this issue Jan 21, 2021
Fix #577, Document nested tests not supported
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Documentation changes only
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants