0

I have a unit test that exercises code in such a way that it causes an assertion to fail. When an assertion fails, it is expected that the application finishes.

To test that this actually happens, I am using EXPECT_DEATH, and it works.

  1. The code execution reaches the assertion line
  2. The assertion fails
  3. The program finishes
  4. The test is passed

The problem is that when the program finishes, there is a window reporting that the program stopped working and I need to click "Close the program" for the tests to continue.

I'd need this window not to pop up at all and that the test continue without the need to press any button. Is this possible?

I am using GCC on MS Windows.

Arturo Gonzalez
  • 335
  • 3
  • 19
  • 1
    This behaviour is platform-specific, and you haven't said what platform you're using. Is it Windows? Is it something else? – Useless Nov 14 '17 at 11:51
  • Possible duplicate of [How can I disable the debug assertion dialog on Windows?](https://stackoverflow.com/questions/13943665/how-can-i-disable-the-debug-assertion-dialog-on-windows) – Mike Kinghan Nov 14 '17 at 12:15
  • yes, it is MS Windows :'( – Arturo Gonzalez Nov 14 '17 at 14:30
  • I don't agree this is a duplicate of [How can I disable the debug assertion dialog on Windows?](https://stackoverflow.com/questions/13943665/how-can-i-disable-the-debug-assertion-dialog-on-windows), the one who asked that question seems to be using Visual C++ and I am using GCC. The most voted answer to that question would't solve mine. I forgot to mention it at first. I already edited the question. – Arturo Gonzalez Nov 18 '17 at 09:53

1 Answers1

0

In Windows you can disable the Windows Error Reporting feature, which let the unwanted windows pop up. The bad news is that this needs to be done differently in different Windows versions. But the good news is that there are good people out there in the net, who have documented it quite well :) E.g. https://www.lifewire.com/how-do-i-disable-error-reporting-in-windows-2626074.

salchint
  • 371
  • 3
  • 10