chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes

I am using Isolator++ Professional (v for a VC++ Project , I have defined some test cases those are executing without error in <debug> build, if I am trying to run then in <Release> build I am getting the following error:

 Assert failed. The function public: int __thiscall jobClass::getNumberOfStages() is too small to be faked. Please consider testing it in debug mode.

The method jobClass::getNumberOfStages() is a very simple single line method it returns the count of stages from CTypedPtrList<>.Count(), and getting same error for few more cases where it returns a single property value.



Net_Plan_Type plan;

int stageCount = 20;

blenderJobClass* jobDesignFake = FAKE<blenderJobClass>(FakeOptions::CallOriginal);

blenderExtendedStageClass* stagePtrFake =  FAKE<blenderExtendedStageClass>(FakeOptions::CallOriginal);

BlenderTruckStage* blenderTruckStageFake = FAKE<BlenderTruckStage>(FakeOptions::CallOriginal);



ISOLATOR_SET_VARIABLE(blenderTruckStageFake, jobDesign, jobDesignFake);



int retCount = blenderTruckStageFake->sendStagePlanToPSW(&plan);

Assert::IsTrue(stageCount == retCount);

Assert::IsTrue(plan.total_stages == stageCount + 1);


catch(exception ex)


CString msg = ex.what();




asked by cvmohan (1.1k points)
edited by cvmohan

2 Answers

0 votes

Hi Cvmohan,

Can you please run the test with logs and sent me them?

Enable the logs in Configuration utility in Isolator++ installation folder.

answered by Alon_TypeMock (9.9k points)
Hi Alan,

Can I get your mail id, so I can forward the logs directly.

1) At present the behavior is some test cases running in Debug build, while come to Release build getting failed.

I am uploading the log files to some shared folder and giving the URL please find the logs from there.

Your immediate attention will be helpful for me, if there any possibility to directly chat with you please let me know.

You can find the logs at :!ArvBSzPPhxyzkVRqA_LrKj5WQbHH?e=KtMRC4

You can reach me at any time


Vishwa Mohan

Hi Vishwa,

Thank you for the logs.

I will dig into them and keep you posted.


Alon Sapozhnikov.

Support Specialist.

0 votes

The provided solution was to unit test the code in Debug mode.
Or if the specific method was too small to be faked a possible solution is to not fake the small method rather modify the unit test according to the behavior change you want to do.

For example for the following code:
class TruckStage {
int stageNumber = 5;
int getStageCount(); 
virtual void checkStageAdvance(int stageNum = -1) = 0;
Implementation file as follow:
int TruckStage::getStageCount() 
return stageNumber;

The following test can work:
TruckStage* truckStage = new TruckStage();
ISOLATOR_SET_VARIABLE(truckStage, stageNumber,5);
Int memberValue;
ISOLATOR_GET_VARIABLE(truckStage, stageNumber, memberValue);
Assert::AreEqual(5, memberValue); 


Alon Sapozhnikov.

Support Specialist.

answered by Alon_TypeMock (9.9k points)

Hi Alon,

Soryy, Above said ISOLATOR_SET_VARIABLE and ISOLATOR_GET_VARIABLE is not going to fulfill my requirements. We may have some business logic to set the variable value. After that logic we are trying to validate the variable value by calling the getxxx() method. 

Again, here the tests are running passed in debug mode, we have only issue with release builds. 

Note: By making the method as inline we are able to solve the problem in release builds also but my development team is not allowing to change none of the code. I am just limited to write the unit tests for the existing code base. 

Thanks for your attention !

Vishwa Mohan

Hi Vishwa,

As we discussed via mail, the inline solution is not good as the method is duplicated and you will be faking the inline method instead of the real one.

A possible solution can be lowering the optimization (compile options: -oO –no optimization).

In any case as you are testing the actual logic we highly recommend to unit tests your code in debug.

Alon Sapozhnikov.
Support Specialist.