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.
| 386 | /// \param name Name of generated report. |
| 387 | /// |
| 388 | void |
| 389 | HtmlOutput::generate(ostream& os, bool incl_ok_tests, const string& name) |
| 390 | { |
| 391 | ClassType type(_total_errors > 0 ? Error : Success); |
| 392 | ostringstream ss; |
| 393 | |
| 394 | header(os, name); |
| 395 | |
| 396 | // Table: Summary |
| 397 | // |
| 398 | sub_title(os, "Summary", 2); |
| 399 | table_header(os, TableClass_Summary, "Summary of test results"); |
| 400 | table_tr_header(os); |
| 401 | table_entry(os, Title, "Tests", 30); |
| 402 | table_entry(os, Title, "Errors", 30); |
| 403 | table_entry(os, Title, "Success", 30); |
| 404 | table_entry(os, Title, "Time (s)", 10); |
| 405 | table_tr_footer(os); |
| 406 | table_tr_header(os); |
| 407 | ss.str(""), ss << _total_tests; |
| 408 | table_entry(os, type, ss.str(), 30); |
| 409 | ss.str(""), ss << _total_errors; |
| 410 | table_entry(os, type, ss.str(), 30); |
| 411 | ss.str(""), ss << correct(_total_tests, _total_errors) << "%"; |
| 412 | table_entry(os, type, ss.str(), 30); |
| 413 | ss.str(""), ss << _total_time; |
| 414 | table_entry(os, type, ss.str(), 10); |
| 415 | table_tr_footer(os); |
| 416 | table_footer(os); |
| 417 | os << "<hr />\n\n"; |
| 418 | |
| 419 | // Table: Test suites |
| 420 | // |
| 421 | sub_title(os, "Test suites", 2); |
| 422 | table_header(os, TableClass_Suites, "Test Suites"); |
| 423 | table_tr_header(os); |
| 424 | table_entry(os, Title, "Name"); |
| 425 | table_entry(os, Title, "Tests", 10); |
| 426 | table_entry(os, Title, "Errors", 10); |
| 427 | table_entry(os, Title, "Success", 10); |
| 428 | table_entry(os, Title, "Time (s)", 10); |
| 429 | table_tr_footer(os); |
| 430 | for_each(_suites.begin(), _suites.end(), SuiteRow(os)); |
| 431 | table_footer(os); |
| 432 | os << "<hr />\n\n"; |
| 433 | |
| 434 | // Individual tests tables |
| 435 | // |
| 436 | for_each(_suites.begin(), _suites.end(), TestSuiteRow(os, incl_ok_tests)); |
| 437 | os << "<hr />\n\n"; |
| 438 | |
| 439 | // Individual tests result tables |
| 440 | // |
| 441 | if(_total_errors != 0) |
| 442 | { |
| 443 | sub_title(os, "Test results", 2); |
| 444 | for_each(_suites.begin(), _suites.end(), SuiteTestResult(os)); |
| 445 | os << "<hr />\n\n"; |
nothing calls this directly
no test coverage detected