kaycxx-test
C++ unit test framework
Loading...
Searching...
No Matches
reporter.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Klaus Reimer <k@ailis.de>
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
11#include <cstddef>
12#include <string_view>
13
16
17namespace kaycxx::test {
18
22class reporter {
23public:
25 virtual ~reporter() = default;
26
33 virtual void before_test_suites(std::size_t num_suites, std::size_t num_tests) = 0;
34
42 virtual void before_test_suite(std::string_view description, std::size_t num_suites, std::size_t num_tests) = 0;
43
51 virtual void before_test_case(std::string_view description) = 0;
52
58 virtual void after_test_case(std::string_view description) = 0;
59
66 virtual void after_test_case(std::string_view description, skipped result) = 0;
67
74 virtual void after_test_case(std::string_view description, failure result) = 0;
75
77 virtual void after_test_suite() = 0;
78
85 virtual void after_test_suite(failure result, std::size_t skipped_tests) = 0;
86
88 virtual void after_test_suites() = 0;
89};
90
91} // namespace kaycxx::test
Failure result passed to reporters when a test case or suite fails.
Definition failure.hpp:25
Receives lifecycle events from the test runner.
Definition reporter.hpp:22
virtual void before_test_suite(std::string_view description, std::size_t num_suites, std::size_t num_tests)=0
Called before a test suite starts.
virtual void after_test_suite(failure result, std::size_t skipped_tests)=0
Called after a test suite failed.
virtual void after_test_case(std::string_view description, skipped result)=0
Called after a test case was skipped.
virtual void after_test_case(std::string_view description, failure result)=0
Called after a test case failed.
virtual void after_test_case(std::string_view description)=0
Called after a test case passed.
virtual void before_test_suites(std::size_t num_suites, std::size_t num_tests)=0
Called before the full test run starts.
virtual void after_test_suites()=0
Called after the full test run finished.
virtual ~reporter()=default
Destroys the reporter.
virtual void after_test_suite()=0
Called after a test suite passed.
virtual void before_test_case(std::string_view description)=0
Called before a test case starts.
Result object passed to reporters when a test case was skipped.
Definition skipped.hpp:19
Defines the test failure result type.
Unit test framework functions and types.
Definition test.hpp:15
Defines the skipped test result type.