#include <event_handler.h>
Public Member Functions | |
virtual void | TestProgramStart (const ProgramSummary &program_summary)=0 |
Called before any test activity starts. | |
virtual void | EnvironmentsSetUpEnd ()=0 |
Called after environment setup for each iteration of tests ends. | |
virtual void | TestSuiteStart (const TestSuite &test_suite)=0 |
Called before the test suite starts. | |
virtual void | TestSuiteEnd (const TestSuite &test_suite)=0 |
Called after the test suite ends. | |
virtual void | EnvironmentsTearDownEnd ()=0 |
Called after environment teardown for each iteration of tests ends. | |
virtual void | TestProgramEnd (const ProgramSummary &program_summary)=0 |
Called after all test activities have ended. | |
virtual void | RunAllTestsStart ()=0 |
Called before all tests are run. | |
virtual void | RunAllTestsEnd (const RunTestsSummary &run_tests_summary)=0 |
Called after all tests are run. | |
virtual void | TestCaseStart (const TestCase &test_case)=0 |
Called when a new test case is started. | |
virtual void | TestCaseEnd (const TestCase &test_case, TestResult result)=0 |
virtual void | TestCaseDisabled (const TestCase &) |
Called when a disabled test case is encountered. | |
virtual void | TestCaseExpect (const TestCase &test_case, const TestExpectation &expectation)=0 |
Collects and processes the results of a unit test run. Its interface is called by the unit test framework as tests are executed and various test events occur.
A program wanting to process test events must define a class implementing the pw::unit_test::EventHandler
interface and register it with the framework. When RUN_ALL_TESTS()
is called, pw_unit_test
notifies the handler of various events which occur in the test process. For example, consider a file containing the following test definitions:
There's one test suite consisting of two test cases. When pw_unit_test
starts running the first test case (MyFirstCase
), it dispatches a TestCaseStart
event to the event handler. It then runs the body of the test, sequentially checking each expectation within. After each expectation, a TestCaseExpect
event is sent to the event handler with the expectation's result. In this case, there's only one, which passes successfully. Finally, after the test is finished, a TestCaseEnd
event is dispatched with the overall result of the test case. pw_unit_test
then runs MySecondCase
in the same way.
|
pure virtual |
Called after environment setup for each iteration of tests ends.
Implemented in pw::unit_test::GoogleTestStyleEventHandler, pw::unit_test::LoggingEventHandler, pw::unit_test::MultiEventHandler< kNumHandlers >, and pw::unit_test::TestRecordEventHandler.
|
pure virtual |
Called after environment teardown for each iteration of tests ends.
Implemented in pw::unit_test::GoogleTestStyleEventHandler, pw::unit_test::LoggingEventHandler, pw::unit_test::MultiEventHandler< kNumHandlers >, and pw::unit_test::TestRecordEventHandler.
|
pure virtual |
Called after all tests are run.
Implemented in pw::unit_test::GoogleTestStyleEventHandler, pw::unit_test::LoggingEventHandler, pw::unit_test::MultiEventHandler< kNumHandlers >, and pw::unit_test::TestRecordEventHandler.
|
pure virtual |
Called before all tests are run.
Implemented in pw::unit_test::GoogleTestStyleEventHandler, pw::unit_test::LoggingEventHandler, pw::unit_test::MultiEventHandler< kNumHandlers >, and pw::unit_test::TestRecordEventHandler.
|
inlinevirtual |
Called when a disabled test case is encountered.
Reimplemented in pw::unit_test::TestRecordEventHandler, pw::unit_test::GoogleTestStyleEventHandler, pw::unit_test::LoggingEventHandler, and pw::unit_test::MultiEventHandler< kNumHandlers >.
|
pure virtual |
Called when a test case completes. The overall result of the test case is provided.
Implemented in pw::unit_test::GoogleTestStyleEventHandler, pw::unit_test::LoggingEventHandler, pw::unit_test::MultiEventHandler< kNumHandlers >, and pw::unit_test::TestRecordEventHandler.
|
pure virtual |
Called after each expect or assert statement within a test case with the result.
Implemented in pw::unit_test::GoogleTestStyleEventHandler, pw::unit_test::LoggingEventHandler, pw::unit_test::MultiEventHandler< kNumHandlers >, and pw::unit_test::TestRecordEventHandler.
|
pure virtual |
Called when a new test case is started.
Implemented in pw::unit_test::TestRecordEventHandler, pw::unit_test::GoogleTestStyleEventHandler, pw::unit_test::LoggingEventHandler, and pw::unit_test::MultiEventHandler< kNumHandlers >.
|
pure virtual |
Called after all test activities have ended.
Implemented in pw::unit_test::TestRecordEventHandler, pw::unit_test::GoogleTestStyleEventHandler, pw::unit_test::LoggingEventHandler, and pw::unit_test::MultiEventHandler< kNumHandlers >.
|
pure virtual |
Called before any test activity starts.
Implemented in pw::unit_test::TestRecordEventHandler, pw::unit_test::GoogleTestStyleEventHandler, pw::unit_test::LoggingEventHandler, and pw::unit_test::MultiEventHandler< kNumHandlers >.
|
pure virtual |
Called after the test suite ends.
Implemented in pw::unit_test::TestRecordEventHandler, pw::unit_test::GoogleTestStyleEventHandler, pw::unit_test::LoggingEventHandler, and pw::unit_test::MultiEventHandler< kNumHandlers >.
|
pure virtual |
Called before the test suite starts.
Implemented in pw::unit_test::TestRecordEventHandler, pw::unit_test::GoogleTestStyleEventHandler, pw::unit_test::LoggingEventHandler, and pw::unit_test::MultiEventHandler< kNumHandlers >.