Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Way to print message to debug output with Visual Studio CppUnitTestFramework

Is there a way to print messages to output window with CppUnitTestFramework in Visual Studio.
There is TRACE() function to display messages from program in the debugger Output window in MFC.
I want to know whether that kind of function exists or not with CppUnitTestFramework.

like image 356
Hill Avatar asked Feb 28 '26 09:02

Hill


1 Answers

The Logger class in the CppUnitTestFramework namespace has two simple functions for this:

Logger::WriteMessage(const wchar_t* message);
Logger::WriteMessage(const char* message);

In the VS IDE, the output can be seen in the "Tests" console output window and can also by clicking the "Output" link seen in the detail panel at the bottom of the Test Explorer.

On a build server the message will appear in the log for the test phase.

like image 170
Chris Olsen Avatar answered Mar 06 '26 20:03

Chris Olsen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!