You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
skliper
changed the title
Unit test should clear event history after setup
Unit test should clear event count history after setup
May 4, 2021
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.
The text was updated successfully, but these errors were encountered: