boost test framework logging xml to file

Hello, is there a way to get test case name from global fixture? What I would like to have is separate xml file report for every test case. I'd like to do it this way: #include <string> #include <fstream> struct LogToFile { LogToFile() { std::string logFileName(boost::unit_test:: framework::master_test_suite().p_name); logFileName = current_test_case_name ; logFile.open(logFileName.c_str(), std::ios_base::app); boost::unit_test::unit_test_log.set_stream(logFile); } ~LogToFile() { logFile << "</TestLog>" << std::flush; logFile.close(); boost::unit_test::unit_test_log.set_stream(std::cout); } std::ofstream logFile; }; BOOST_GLOBAL_FIXTURE(LogToFile); Can I do that? Regards

Jarosław Bober
Hello,is there a way to get test case name from global fixture?
Global fixture is executed once per test module. What you need is to change test log stream in case case fixture which does have an access to the test case through framework::current_test_case().p_name. Gennadiy
participants (2)
-
Gennadiy Rozental
-
Jarosław Bober