locked
Howto use Asserts in threads? RRS feed

  • Question

  • Is there any suggestion how to use Assert-statements in asynchron running threads within the CppUnitTestFramework?

    Our szenario:  We built a library for the communication between asynchronous running threads. The unit tests for the cases that a thread should send a request or another thread should receive a response are easy to realize. In communication, however, time behavior is also relevant. Therefore I implemented in an earlier implementations (VisualStudio 2008 with Visual Assert, Cfix unit test framework) two asynchronous running threads  and ensured the correct behaviour and timing by Assert statements. That framework provided a special method for creating a thread (CfixCreateThread). And it works: in case of failures, the thread was terminated and the error message was added to the test report. 

    Unfortunately, this no longer works with the CppUnitTestFramework of VisualStudio 2015 or 2017. Now, a failed Assert statement will crash the thread and furthermore the whole test runner application.

    Thanks,
    Friedbert

    Wednesday, August 8, 2018 8:23 AM