File indexing completed on 2025-01-30 10:01:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER
0016 #define BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER
0017
0018
0019 #include <boost/test/results_collector.hpp>
0020 #include <boost/test/output/xml_report_formatter.hpp>
0021
0022 #include <boost/test/tree/test_unit.hpp>
0023 #include <boost/test/utils/xml_printer.hpp>
0024 #include <boost/test/utils/basic_cstring/io.hpp>
0025
0026 #include <boost/test/detail/suppress_warnings.hpp>
0027
0028
0029
0030 namespace boost {
0031 namespace unit_test {
0032 namespace output {
0033
0034 void
0035 xml_report_formatter::results_report_start( std::ostream& ostr )
0036 {
0037 ostr << "<TestResult>";
0038 }
0039
0040
0041
0042 void
0043 xml_report_formatter::results_report_finish( std::ostream& ostr )
0044 {
0045 ostr << "</TestResult>";
0046 }
0047
0048
0049
0050
0051 void
0052 xml_report_formatter::test_unit_report_start( test_unit const& tu, std::ostream& ostr )
0053 {
0054 test_results const& tr = results_collector.results( tu.p_id );
0055
0056 const_string descr;
0057
0058 if( tr.passed() )
0059 descr = "passed";
0060 else if( tr.p_skipped )
0061 descr = "skipped";
0062 else if( tr.p_timed_out )
0063 descr = "timed-out";
0064 else if( tr.p_aborted )
0065 descr = "aborted";
0066 else
0067 descr = "failed";
0068
0069 ostr << '<' << ( tu.p_type == TUT_CASE ? "TestCase" : "TestSuite" )
0070 << " name" << utils::attr_value() << tu.p_name.get()
0071 << " result" << utils::attr_value() << descr
0072 << " assertions_passed" << utils::attr_value() << tr.p_assertions_passed
0073 << " assertions_failed" << utils::attr_value() << tr.p_assertions_failed
0074 << " warnings_failed" << utils::attr_value() << tr.p_warnings_failed
0075 << " expected_failures" << utils::attr_value() << tr.p_expected_failures
0076 ;
0077
0078 if( tu.p_type == TUT_SUITE ) {
0079 ostr << " test_cases_passed" << utils::attr_value() << tr.p_test_cases_passed
0080 << " test_cases_passed_with_warnings" << utils::attr_value() << tr.p_test_cases_warned
0081 << " test_cases_failed" << utils::attr_value() << tr.p_test_cases_failed
0082 << " test_cases_skipped" << utils::attr_value() << tr.p_test_cases_skipped
0083 << " test_cases_aborted" << utils::attr_value() << tr.p_test_cases_aborted
0084 << " test_cases_timed_out" << utils::attr_value() << tr.p_test_cases_timed_out
0085 << " test_suites_timed_out"<< utils::attr_value() << tr.p_test_suites_timed_out
0086 ;
0087 }
0088
0089 ostr << '>';
0090 }
0091
0092
0093
0094 void
0095 xml_report_formatter::test_unit_report_finish( test_unit const& tu, std::ostream& ostr )
0096 {
0097 ostr << "</" << ( tu.p_type == TUT_CASE ? "TestCase" : "TestSuite" ) << '>';
0098 }
0099
0100
0101
0102 void
0103 xml_report_formatter::do_confirmation_report( test_unit const& tu, std::ostream& ostr )
0104 {
0105 test_unit_report_start( tu, ostr );
0106 test_unit_report_finish( tu, ostr );
0107 }
0108
0109
0110
0111 }
0112 }
0113 }
0114
0115 #include <boost/test/detail/enable_warnings.hpp>
0116
0117 #endif