Forum Discussion

daniel_bostrom's avatar
daniel_bostrom
New Contributor
12 years ago

C++ MFC unit tests always succeed

I am trying to run a number of unit tests for a MFC application; I have set it up according to the MFC unit test sample that is bundled with TestComplete. The problem is that my test methods always succeed, even when I want them to fail. Your sample works but when I copy the same test methods over to my project the ones that used to fail now all of a sudden succeed. For example this succeeds in my project:





void CMyTestClass::DoDivByZero(void)


{


int y, x;


    Log["Message"]("CMyTestClass.DoDivByZero");


x = 0;


y =  10 / x;


    throw "Exception";


}





Any idea what could be wrong?



Thanks 

Daniel

  • Enabling "Advanced exception handling" in Project properties -> Open Applications -> Debug Agent seems to have done the trick, now I get the result I expect.