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

[MOVED] Document nested usage of UT_ADD_TEST and clarify nomenclature for individual versus groups of tests #578

Closed
astrogeco opened this issue Aug 25, 2020 · 7 comments
Labels
bug invalid unit-test Tickets related to the OSAL unit testing (functional and/or coverage)

Comments

@astrogeco
Copy link
Contributor

astrogeco commented Aug 25, 2020

Describe the problem

The UT_ADD_TEST call has some limitations as addressed in nasa/cFE#840. Some solutions are discussed in that PR.

Proposed Solutions

  1. Have UT_ADD_TEST handle "nested" unit tests, OR
  2. Develop a nomenclature for unit test functions that explicitly indicates whether there are nested unit tests and then rename unit tests accordingly, OR
  3. Document the anti-pattern, OR
  4. Split up all unit tests to ensure only one test per function and make this a design pattern.

Additional Context

Originally posted by @skliper in nasa/cFE#840 (comment)

Related to #577. Individual tests are added w/ the UT_ADD_TEST call. Some tests are grouped at a lower level (Test_MSG_CCSDSExt is a group of tests), and those functions are called directly. Same pattern is used in sb:

https://github.com/nasa/cFE/blob/a148b97511de3f45f6677c1a3a0b17197f867e28/fsw/cfe-core/unit-test/sb_UT.c#L134-L135

@astrogeco astrogeco added unit-test Tickets related to the OSAL unit testing (functional and/or coverage) bug labels Aug 25, 2020
@astrogeco astrogeco changed the title Clarify usage of UT_ADD_TEST and clarify nomenclature for individual versus groups of tests Document nested usage of UT_ADD_TEST and clarify nomenclature for individual versus groups of tests Aug 25, 2020
@skliper
Copy link
Contributor

skliper commented Aug 25, 2020

This may belong in nasa/cfe, which own UT_ADD_TEST and UT_AddSubTest, and the unit tests that employ this model.

@astrogeco
Copy link
Contributor Author

This may belong in nasa/cfe, which own UT_ADD_TEST and UT_AddSubTest, and the unit tests that employ this model.

ah I put it here since you mentioned UT_Assert :(

@skliper
Copy link
Contributor

skliper commented Aug 25, 2020

The osal relation is you shouldn't call UtTest_Add from within another test that was registered with UtTest_Add. This is the subject of #577.

@astrogeco
Copy link
Contributor Author

Would it make sense to keep both of them open then? maybe reframe #577 as prevent that behavior or document it?

@astrogeco
Copy link
Contributor Author

astrogeco commented Aug 25, 2020

Edit: move this one to cfe but reopen and reframe #577 ?

@skliper
Copy link
Contributor

skliper commented Aug 25, 2020

I'm fine with however you want to handle it.

@astrogeco
Copy link
Contributor Author

Moved to nasa/cFE#841

@astrogeco astrogeco changed the title Document nested usage of UT_ADD_TEST and clarify nomenclature for individual versus groups of tests MOVED to nasa/cFE: Document nested usage of UT_ADD_TEST and clarify nomenclature for individual versus groups of tests Aug 25, 2020
@astrogeco astrogeco changed the title MOVED to nasa/cFE: Document nested usage of UT_ADD_TEST and clarify nomenclature for individual versus groups of tests [MOVED to nasa/cFE] Document nested usage of UT_ADD_TEST and clarify nomenclature for individual versus groups of tests Aug 25, 2020
@astrogeco astrogeco changed the title [MOVED to nasa/cFE] Document nested usage of UT_ADD_TEST and clarify nomenclature for individual versus groups of tests [MOVED] Document nested usage of UT_ADD_TEST and clarify nomenclature for individual versus groups of tests Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug invalid unit-test Tickets related to the OSAL unit testing (functional and/or coverage)
Projects
None yet
Development

No branches or pull requests

2 participants