Skip to content
Snippets Groups Projects
Commit 213450db authored by Botond Baranyi's avatar Botond Baranyi
Browse files

Fixed error logging in JUnitLogger (bug 515104)


Change-Id: Ia83af2a298b9c9ef161935fba447b42a2a9c12f8
Signed-off-by: default avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent 2096cd8d
No related branches found
No related tags found
No related merge requests found
...@@ -46,6 +46,7 @@ JUnitLogger::JUnitLogger() ...@@ -46,6 +46,7 @@ JUnitLogger::JUnitLogger()
minor_version_ = 0; minor_version_ = 0;
name_ = mcopystr("JUnitLogger"); name_ = mcopystr("JUnitLogger");
help_ = mcopystr("JUnitLogger writes JUnit-compatible XML"); help_ = mcopystr("JUnitLogger writes JUnit-compatible XML");
error_message = "";
//printf("%5lu:constructed\n", (unsigned long)getpid()); //printf("%5lu:constructed\n", (unsigned long)getpid());
} }
...@@ -251,11 +252,13 @@ void JUnitLogger::log(const TitanLoggerApi::TitanLogEvent& event, ...@@ -251,11 +252,13 @@ void JUnitLogger::log(const TitanLoggerApi::TitanLogEvent& event,
case TitanLoggerApi::Verdict::v4error: case TitanLoggerApi::Verdict::v4error:
fprintf(file_stream_, " <error type='DTE'>%s</error>\n", fprintf(file_stream_, " <error type='DTE'>%s</error>\n",
(const char*)escape_xml_element(tct.reason())); (const char*)error_message);
break; break;
} }
// error or skip based on verdict // error or skip based on verdict
fputs(" </testcase>\n", file_stream_); fputs(" </testcase>\n", file_stream_);
// erase the stored error message
error_message = "";
break; } break; }
case TitanLoggerApi::TestcaseEvent_choice::UNBOUND_VALUE: case TitanLoggerApi::TestcaseEvent_choice::UNBOUND_VALUE:
...@@ -266,10 +269,9 @@ void JUnitLogger::log(const TitanLoggerApi::TitanLogEvent& event, ...@@ -266,10 +269,9 @@ void JUnitLogger::log(const TitanLoggerApi::TitanLogEvent& event,
break; } // testcaseOp break; } // testcaseOp
case TitanLoggerApi::LogEventType_choice::ALT_errorLog: { case TitanLoggerApi::LogEventType_choice::ALT_errorLog: {
// A DTE is about to be thrown // A DTE is about to be thrown,
const TitanLoggerApi::Categorized& cat = choice.errorLog(); // store the error message until the testcase finished event
fprintf(file_stream_, " <error type='DTE'>%s</error>\n", error_message += escape_xml_element(choice.errorLog().text());
(const char*)escape_xml_element(cat.text()));
break; } break; }
default: default:
......
...@@ -50,6 +50,7 @@ private: ...@@ -50,6 +50,7 @@ private:
// working values // working values
char *filename_; char *filename_;
FILE *file_stream_; FILE *file_stream_;
CHARSTRING error_message;
}; };
#endif // JUnitLogger_HH #endif // JUnitLogger_HH
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment