Пример #1
0
    void XmlOutput::generate(ostream& os, bool incl_ok_tests, const string& name)
    {
        ostringstream   ss;
        header(os);

        table_header(os, "FailedTests");
        for_each(_suites.begin(), _suites.end(), TestSuiteRowFalse(os));
        table_footer(os, "FailedTests");

        table_header(os, "SuccessfulTests");
        for_each(_suites.begin(), _suites.end(), TestSuiteRowTrue(os));
        table_footer(os, "SuccessfulTests");

        ///> Summary
        table_header(os, "Statistics");
        ss.str(""), ss << _total_tests;
        table_entry(os, ss.str(), "Tests");
        ss.str(""),  ss << _total_errors;
        table_entry(os, ss.str(), "FailuresTotal");
        table_entry(os, "0", "Errors");
        table_entry(os, ss.str(), "Failures");
        table_footer(os, "Statistics");

        footer(os);
    }
Пример #2
0
		void operator()(const SuiteInfo& si)
		{
			std::ostringstream ss;
			
			sub_title(_os, "Suite: " + si._name, 3, si._name);
			table_header(_os, TableClass_Suite, "Details for suite " + si._name);
			  table_tr_header(_os);
			    table_entry(_os, Title, "Name");
			    table_entry(_os, Title, "Errors", 10);
			    table_entry(_os, Title, "Success", 10);
			    table_entry(_os, Title, "Time (s)", 10);
			  table_tr_footer(_os);
			  std::for_each(si._tests.begin(), si._tests.end(), 
					        TestRow(_os, _incl_ok_tests));
			table_footer(_os);
			back_ref(_os, "top");
		}
Пример #3
0
		void operator()(const Source& s)
		{
			const int TitleSize = 15;
			
			std::ostringstream ss;
			
			table_header(_os, TableClass_Result, "Test Failure");
			  table_tr_header(_os);
				table_entry(_os, Title, "Test", TitleSize);
				table_entry(_os, Success, s.suite() + "::" + s.test());
			  table_tr_footer(_os);
			  table_tr_header(_os);
				table_entry(_os, Title, "File", TitleSize);
				ss << s.file() << ":" << s.line();
				table_entry(_os, Success, ss.str());
			  table_tr_footer(_os);
			  table_tr_header(_os);
				table_entry(_os, Title, "Message", TitleSize);
				table_entry(_os, Success, s.message());
			  table_tr_footer(_os);
			table_footer(_os);
		}
Пример #4
0
	/// Generates the HTML table. This function should only be called after
	/// run(), when all tests have been executed.
	///
	/// \param os            Output stream.
	/// \param incl_ok_tests Set if successful tests should be shown; 
	///                      false otherwise.
	/// \param name          Name of generated report.
	///
    void
	HtmlOutput::generate(std::ostream& os, bool incl_ok_tests, const std::string& name)
	{
		ClassType 		type(_total_errors > 0 ? Error : Success);
		std::ostringstream 	ss;
		
		header(os, name);
		
		// Table: Summary
		//
		sub_title(os, "Summary", 2);
		table_header(os, TableClass_Summary, "Summary of test results");
		  table_tr_header(os);
		    table_entry(os, Title, "Tests", 30);
		    table_entry(os, Title, "Errors", 30);
		    table_entry(os, Title, "Success", 30);
		    table_entry(os, Title, "Time (s)", 10);
		  table_tr_footer(os);
		  table_tr_header(os);
		    ss.str(""), ss << _total_tests;
 		    table_entry(os, type, ss.str(), 30);
			ss.str(""),  ss << _total_errors;
		    table_entry(os, type, ss.str(), 30);
			ss.str(""),  ss << correct(_total_tests, _total_errors) << "%";
		    table_entry(os, type, ss.str(), 30);
			ss.str(""), ss << _total_time;
		    table_entry(os, type, ss.str(), 10);
		  table_tr_footer(os);
		table_footer(os);
		os << "<hr />\n\n";
		
		// Table: Test suites
		//
		sub_title(os, "Test suites", 2);
		table_header(os, TableClass_Suites, "Test Suites");
		  table_tr_header(os);
		    table_entry(os, Title, "Name");
		    table_entry(os, Title, "Tests",   10);
		    table_entry(os, Title, "Errors",  10);
		    table_entry(os, Title, "Success",    10);
		    table_entry(os, Title, "Time (s)", 10);
		  table_tr_footer(os);
		  std::for_each(_suites.begin(), _suites.end(), SuiteRow(os));
		table_footer(os);
		os << "<hr />\n\n";
		
		// Individual tests tables
		//
		std::for_each(_suites.begin(), _suites.end(), TestSuiteRow(os, incl_ok_tests));
		os << "<hr />\n\n";
		
		// Individual tests result tables
		//
		if(_total_errors != 0)
		{
			sub_title(os, "Test results", 2);
			std::for_each(_suites.begin(), _suites.end(), SuiteTestResult(os));
			os << "<hr />\n\n";
		}		
		// EOF
		//
		footer(os);
	}