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

Unit test should clear event count history after setup #1143

Open
jphickey opened this issue Jan 29, 2021 · 0 comments · May be fixed by #2347
Open

Unit test should clear event count history after setup #1143

jphickey opened this issue Jan 29, 2021 · 0 comments · May be fixed by #2347

Comments

@jphickey
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Test cases that check for events should focus on the events actually sent by the unit under test. But many test cases also require some "setup" calls, which also may generate events.

As a result the "assert" is checking for all events from the combination of (setup + test).

This makes tests more fragile, because many tests call the same routine e.g. CFE_SB_AppInit() as part of the test setup. In the current implementation this appears to generate 5 events in its default/nominal mode. But when (not if) CFE_SB_AppInit() changes in any way that affects its nominal events (very easy to do) it breaks nearly every test in SB.

Describe the solution you'd like
For any call considered "setup" it should discard any events generated by the call, thereby not including them in the set that will be validated later as part of the test case.

Additional context
Note that all functions (by definition) have their own test case where events will be verified. It doesn't need to be verified again when it is used as the setup for something else. Doing so just causes more maintenance work.

This also makes test cases clearer - as they should only be checking for events that are actually generated by the function under test.

Requester Info
Joseph Hickey, Vantage Systems, Inc.

@skliper skliper changed the title Unit test should clear event history after setup Unit test should clear event count history after setup May 4, 2021
thnkslprpt added a commit to thnkslprpt/cFE that referenced this issue May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants