Redirecting the detailed test report
Hi, Recently we have decided to use the Boost Test libraries to provide automated tests to our project. To help with the test result visualization, we created an utility to generate HTML pages from Boost test reports (as generated by -- report_level=detailed). In the begining of implementation, the amount of tests was small and we could just cut-and-paste the test report to a file used as the input of out in-house HTML generator. Now, the amount of tests increased and cutting-and-pasting the report become a pain. So the question: How can we send the test report to a separated file? We used unit_test_log::instance().set_log_stream( stream ) in the definition of test_suite* init_unit_test_suite( int argc, char* argv[] ) to redirect the test log and it worked fine. However, unit_test_result::instance().detailed_report( stream ) can not be used in the same way. We can not simply redirect the test output to a file (using ">") because our application prints lots of information during execution and is pretty hard to change this behaviour. Thanks in advance.
Hi,
Recently we have decided to use the Boost Test libraries to provide automated tests to our project. To help with the test result visualization, we created an utility to generate HTML pages from Boost test reports (as generated by -- report_level=detailed). In the begining of implementation, the amount of tests was small and we could just cut-and-paste the test report to a file used as the input of out in-house HTML generator. Now, the amount of tests increased and cutting-and-pasting the report become a pain.
So the question: How can we send the test report to a separated file? We used
unit_test_log::instance().set_log_stream( stream )
in the definition of
test_suite* init_unit_test_suite( int argc, char* argv[] )
to redirect the test log and it worked fine. However,
unit_test_result::instance().detailed_report( stream )
can not be used in the same way. We can not simply redirect the test output to a file (using ">") because our application prints lots of information during execution and is pretty hard to change this behavior.
Did you try to redirect only stderr using 2 > file_name? If it still unacceptable you could patch unit_test_main.cpp locally. I will consider adding this customization for next release. Gennadiy.
We can not simply redirect the test output to a file (using ">") because our application prints lots of information during execution and is pretty hard to change this behavior.
Did you try to redirect only stderr using 2 > file_name? If it still unacceptable you could patch unit_test_main.cpp locally. I will consider adding this customization for next release.
Gennadiy.
Thanks for the answear. I can not redirect stderr. Some of the libraries used in our application implementation prints stuff directly to stderr. But I will follow your second advice and change the report output file in the unit_test_main.cpp. Regards, Hermann
participants (2)
-
Gennadiy Rozental
-
Hermann Oliveira Rodrigues