The Grail42 github project now contains adapters to normalize and simplify the use of the C++ unit testing frameworks Template Unit Test Framework (TUT) and Google Test (gtest) in Visual Studio. The code has been tested to build for and execute on Windows 7, Android 2.2, and Chrome Native Client 23. For the later two platforms the VS add-ins for those platforms were used, so the code is known to build with gcc as well as msvc. An adapter for cpputest will be added shortly as well.
As TUT does not utilize any C preprocessor macros its test failure messages do not include filename and line number information. On the other hand, the adapter macros and common reporter adapter that Grail42 supplies for TUT do include filenames and line numbers in failures messages. The adapter macros are also result in more concise unit test code as demonstrated by the example below.
The benefits the adapter for gtest provide are less significant than for TUT. Its primary purpose is actually just to facilitate the unit testing of a to be developed thread safe unit testing framework as mentioned here.
This is an example of the output provided by the Grail42 adapter for TUT or gtest for a single failing test:
*** Tests started ***
*** Tests complete: 0 passed, 1 failed, 0 skipped ***
versus the stock output of TUT for the same:
basic test: [1=F]
---> group: basic test, test: test
problem: assertion failed
tests summary: failures:1 ok:0
This is the code using the Grail42 adapter for TUT or gtest to produce the above output:
int wmain(int, wchar_t* )
versus code that directly uses TUT to accomplish the same:
typedef test_group<basic> factory;
typedef factory::object object;
tut::factory tf("basic test");
int wmain(int argc, wchar_t* argv)