[CMake] CxxTest failure output running unit tests

Tron Thomas tron.thomas at verizon.net
Sun Dec 7 20:49:16 EST 2008


 From the standpoint of using CxxTest, it doesn't seem like the test are 
useful unless there is verbose output.  When a tests fails, someone will 
have no idea was caused the failure unless they use verbose output to 
see the output from the test.  I don't know how much verbose output is 
produced when a test is successful.  If there is not a lot then it might 
not be that big of an issue.  Otherwise it would be nice if there were a 
way to produce verbose output during a failure and maybe normal output 
when a test succeeds.

Bill Hoffman wrote:
> Tron Thomas wrote:
>> I think I have a solution.
>> It involves creating a new target that basically replaces the "test" 
>> target for Makefiles or the RUN_TESTS target generated for IDE's.
>>
>> I added this:
>> add_custom_taget(TestAll ALL {CMAKE_TEST_COMMAND} -V)
>>
>> I then have a macro define that generates all the information to 
>> create a CxxTest unit test.  In that macro I include:
>> add_dependencies(TestAll ${Name})
>>
>> where ${Name} is an argument passed to the macro that determines the 
>> name for the unit test.  This makes sure that all unit tests are 
>> built before the TestAll target tries to run tests during its build 
>> phase.
>>
>> All of these steps cause the unit tests to be run with verbose 
>> output, which can help someone understand where problems are when 
>> tests fail.  It also runs these tests as part of building everything, 
>> which is also what I want to happen.
>>
>> It would be nice if the original "test" and RUN_TESTS targets could 
>> be configured this way without having to create and additional target 
>> that replaces them.
>>
> But, some people like short output.   If you have lots of output with 
> lots of tests it becomes really hard to see where one test starts and 
> the next one ends.  So, there would have to be two different types of 
> targets.  However, I think this thread is about yet another way 
> someone wants the tests to work.  In this case, I think that the 
> verbose output is only wanted for tests that fail.  It is not going to 
> be possible to make everyone happy....
>
> -Bill
>



More information about the CMake mailing list