Consolidate repeated unit test setup code into helper functions
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 120
- Forks
- 77
- Avg merge
- 7d 18h
- Merged PRs (30d)
- 3
Description
In the CF unit tests, the "preconditions" for each test case are often very similar, but instead of being set up through some sort of helper function, the code is cut-and-pasted. As a result, code to set up for particular preconditions may be repeated dozens of times in the unit test.
This incurs a significant maintenance cost when the FSW data structures need to change in any way (and they will, the FSW is not set in stone and will need to be maintained). A small change to FSW can affect many different unit test cases. This wouldn't be a big problem if the setup was in some sort of helper function, but since it is repeated, each affected case must be individually found and fixed. As a result, the time cost of maintaining the unit test is extremely high.
To reduce this cost, common sequences of setup (such as setting up for an input PDU, an output PDU, etc) should be consolidated into a helper function, so only this function needs to change if the internal FSW structures change.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name specific files or tests. Start by locating the CF unit-test suites and inventory repeated precondition setup for input and output PDUs; confirm the common sequences and their callers before choosing helper boundaries. Done means the repeated setup is centralized and the unit tests still pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot, testing
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100