diff --git a/loggerplugins/JUnitLogger/JUnitLogger.cc b/loggerplugins/JUnitLogger/JUnitLogger.cc index 812d340e41eb25fb5654f89bfbe7508241a1cf9d..dc41804b7cec236740568ff317e7eb473a6908e5 100644 --- a/loggerplugins/JUnitLogger/JUnitLogger.cc +++ b/loggerplugins/JUnitLogger/JUnitLogger.cc @@ -46,6 +46,7 @@ JUnitLogger::JUnitLogger() minor_version_ = 0; name_ = mcopystr("JUnitLogger"); help_ = mcopystr("JUnitLogger writes JUnit-compatible XML"); + error_message = ""; //printf("%5lu:constructed\n", (unsigned long)getpid()); } @@ -251,11 +252,13 @@ void JUnitLogger::log(const TitanLoggerApi::TitanLogEvent& event, case TitanLoggerApi::Verdict::v4error: fprintf(file_stream_, " <error type='DTE'>%s</error>\n", - (const char*)escape_xml_element(tct.reason())); + (const char*)error_message); break; } // error or skip based on verdict fputs(" </testcase>\n", file_stream_); + // erase the stored error message + error_message = ""; break; } case TitanLoggerApi::TestcaseEvent_choice::UNBOUND_VALUE: @@ -266,10 +269,9 @@ void JUnitLogger::log(const TitanLoggerApi::TitanLogEvent& event, break; } // testcaseOp case TitanLoggerApi::LogEventType_choice::ALT_errorLog: { - // A DTE is about to be thrown - const TitanLoggerApi::Categorized& cat = choice.errorLog(); - fprintf(file_stream_, " <error type='DTE'>%s</error>\n", - (const char*)escape_xml_element(cat.text())); + // A DTE is about to be thrown, + // store the error message until the testcase finished event + error_message += escape_xml_element(choice.errorLog().text()); break; } default: diff --git a/loggerplugins/JUnitLogger/JUnitLogger.hh b/loggerplugins/JUnitLogger/JUnitLogger.hh index 9894512d28073afacfc3546f2db2596aa2eef33a..47cd5788f229f8a752fa77cc06f4367b50c53418 100644 --- a/loggerplugins/JUnitLogger/JUnitLogger.hh +++ b/loggerplugins/JUnitLogger/JUnitLogger.hh @@ -50,6 +50,7 @@ private: // working values char *filename_; FILE *file_stream_; + CHARSTRING error_message; }; #endif // JUnitLogger_HH