Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
testing::internal::XmlUnitTestResultPrinter Class Reference
Inheritance diagram for testing::internal::XmlUnitTestResultPrinter:
Collaboration diagram for testing::internal::XmlUnitTestResultPrinter:

Public Member Functions

 XmlUnitTestResultPrinter (const char *output_file)
 
virtual void OnTestIterationEnd (const UnitTest &unit_test, int iteration)
 
- Public Member Functions inherited from testing::EmptyTestEventListener
virtual void OnTestProgramStart (const UnitTest &)
 
virtual void OnTestIterationStart (const UnitTest &, int)
 
virtual void OnEnvironmentsSetUpStart (const UnitTest &)
 
virtual void OnEnvironmentsSetUpEnd (const UnitTest &)
 
virtual void OnTestCaseStart (const TestCase &)
 
virtual void OnTestStart (const TestInfo &)
 
virtual void OnTestPartResult (const TestPartResult &)
 
virtual void OnTestEnd (const TestInfo &)
 
virtual void OnTestCaseEnd (const TestCase &)
 
virtual void OnEnvironmentsTearDownStart (const UnitTest &)
 
virtual void OnEnvironmentsTearDownEnd (const UnitTest &)
 
virtual void OnTestProgramEnd (const UnitTest &)
 
- Public Member Functions inherited from testing::TestEventListener
virtual ~TestEventListener ()
 

Detailed Description

Definition at line 3392 of file gtest.cc.

Constructor & Destructor Documentation

◆ XmlUnitTestResultPrinter()

testing::internal::XmlUnitTestResultPrinter::XmlUnitTestResultPrinter ( const char * output_file)
explicit

Definition at line 3470 of file gtest.cc.

3471 : output_file_(output_file) {
3472 if (output_file_.c_str() == NULL || output_file_.empty()) {
3473 GTEST_LOG_(FATAL) << "XML output file may not be null";
3474 }
3475}
#define GTEST_LOG_(severity)

Member Function Documentation

◆ OnTestIterationEnd()

void testing::internal::XmlUnitTestResultPrinter::OnTestIterationEnd ( const UnitTest & unit_test,
int iteration )
virtual

Reimplemented from testing::EmptyTestEventListener.

Definition at line 3478 of file gtest.cc.

3479 {
3480 FILE* xmlout = NULL;
3481 FilePath output_file(output_file_);
3482 FilePath output_dir(output_file.RemoveFileName());
3483
3484 if (output_dir.CreateDirectoriesRecursively()) {
3485 xmlout = posix::FOpen(output_file_.c_str(), "w");
3486 }
3487 if (xmlout == NULL) {
3488 // TODO(wan): report the reason of the failure.
3489 //
3490 // We don't do it for now as:
3491 //
3492 // 1. There is no urgent need for it.
3493 // 2. It's a bit involved to make the errno variable thread-safe on
3494 // all three operating systems (Linux, Windows, and Mac OS).
3495 // 3. To interpret the meaning of errno in a thread-safe way,
3496 // we need the strerror_r() function, which is not available on
3497 // Windows.
3498
3499 GTEST_LOG_(FATAL) << "Unable to open file \"" << output_file_ << "\"";
3500 }
3501 std::stringstream stream;
3502 PrintXmlUnitTest(&stream, unit_test);
3503 fprintf(xmlout, "%s", StringStreamToString(&stream).c_str());
3504 fclose(xmlout);
3505}
FILE * FOpen(const char *path, const char *mode)
GTEST_API_ std::string StringStreamToString(::std::stringstream *stream)
Definition gtest.cc:1997
Here is the call graph for this function:

The documentation for this class was generated from the following file: