cmock ExpectAndReturn, markers

53 views
Skip to first unread message

Grant Rolls

unread,
Dec 6, 2022, 1:35:28 AM12/6/22
to ThrowTheSwitch Forums
Hi, 

A common pattern I use is to have a function for the mocking setup, as a lot of this is repeated. Each test will call the expectation setup fn with different parameters.

The issue comes when multiple setup/executes are used in a single test. 
When an expectation fails - the test reports the failures at the line inside the generic function. The values often give no reference to which part of the test failed

Is there any way to add a marker or something, so I can know which part of the test actually did the expectation setup?

Paul V

unread,
Oct 14, 2023, 1:19:16 PM10/14/23
to ThrowTheSwitch Forums
The gurus (not me, I'm just following ;) ) recommend testing only one aspect in one test case, among other things for exactly the reason you described.

But you can insert TEST_MESSAGE() between the single SuT execute steps to indicate which step was completed.
Reply all
Reply to author
Forward
0 new messages