I know by default report is directed to standard-error, and so one has to redirect it to a file. My question is shall we do this inside a global fixture? Which isn't seem to be working for me some how.
This is what i tried -
struct MyConfig
{
MyConfig()
: testReport("fileName.log")
{
if(!testReport.fail())
original = std::cerr.rdbuf(testReport.rdbuf());
}
~MyConfig()
{
cerr.rdbuf(original);
testReport.close();
}
ofstream testReport;
streambuf* original;
};
BOOST_GLOBAL_FIXTURE(MyConfig);
After running the test, report outputs on console only, though a 0kb file is created with the given name.