FreeNOS
TestReporter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Niek Linnenbank
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __LIBTEST_TESTREPORTER_H
19 #define __LIBTEST_TESTREPORTER_H
20 
21 #include <Types.h>
22 #include "TestCase.h"
23 
36 {
37  public:
38 
42  TestReporter(int argc, char **argv);
43 
47  virtual ~TestReporter();
48 
52  uint getOk() const;
53 
57  uint getFailed() const;
58 
62  uint getSkipped() const;
63 
67  void setReport(bool value);
68 
72  void setStatistics(bool value);
73 
77  void setMultiline(bool value);
78 
82  virtual void prepare(TestInstance & test);
83 
87  virtual void collect(TestInstance & test, TestResult & result);
88 
92  virtual void begin(List<TestInstance *> & tests);
93 
97  virtual void finish(List<TestInstance *> & tests);
98 
99  protected:
100 
104  virtual void reportBegin(List<TestInstance *> & tests) = 0;
105 
109  virtual void reportBefore(TestInstance & test) = 0;
110 
114  virtual void reportAfter(TestInstance & test, TestResult & result) = 0;
115 
119  virtual void reportFinish(List<TestInstance *> & tests) = 0;
120 
121  protected:
122 
124  int m_argc;
125 
127  char ** m_argv;
128 
130  bool m_report;
131 
134 
137 
140 };
141 
147 #endif /* __LIBTEST_TESTREPORTER_H */
TestReporter::reportBefore
virtual void reportBefore(TestInstance &test)=0
Report start of a test.
TestReporter::~TestReporter
virtual ~TestReporter()
Destructor.
Definition: TestReporter.cpp:33
Types.h
TestReporter::m_argc
int m_argc
Argument count.
Definition: TestReporter.h:124
TestReporter::getOk
uint getOk() const
Get OK count.
Definition: TestReporter.cpp:37
TestReporter::m_skip
uint m_skip
Definition: TestReporter.h:139
TestReporter::begin
virtual void begin(List< TestInstance * > &tests)
Begin testing.
Definition: TestReporter.cpp:88
TestReporter::m_statistics
bool m_statistics
Final statistics on/off.
Definition: TestReporter.h:133
TestReporter::m_multiline
bool m_multiline
Multi line output.
Definition: TestReporter.h:136
TestReporter::finish
virtual void finish(List< TestInstance * > &tests)
Finish testing.
Definition: TestReporter.cpp:94
uint
unsigned int uint
Unsigned integer number.
Definition: Types.h:44
TestReporter::getSkipped
uint getSkipped() const
Get skip count.
Definition: TestReporter.cpp:47
TestReporter::m_fail
uint m_fail
Definition: TestReporter.h:139
TestReporter::prepare
virtual void prepare(TestInstance &test)
Prepare for next test.
Definition: TestReporter.cpp:67
TestReporter::m_argv
char ** m_argv
Argument values.
Definition: TestReporter.h:127
TestReporter::m_ok
uint m_ok
Test statistics.
Definition: TestReporter.h:139
TestReporter::collect
virtual void collect(TestInstance &test, TestResult &result)
Collect test statistics.
Definition: TestReporter.cpp:73
TestReporter::reportBegin
virtual void reportBegin(List< TestInstance * > &tests)=0
Report start of testing.
TestReporter::setMultiline
void setMultiline(bool value)
Set multine mode on/off.
Definition: TestReporter.cpp:62
TestReporter::TestReporter
TestReporter(int argc, char **argv)
Constructor.
Definition: TestReporter.cpp:21
TestResult
Represents a Test result created by a TestInstance.
Definition: TestResult.h:47
TestReporter::reportFinish
virtual void reportFinish(List< TestInstance * > &tests)=0
Report completion of all tests.
TestReporter::setReport
void setReport(bool value)
Set reporting on/off.
Definition: TestReporter.cpp:52
TestReporter::reportAfter
virtual void reportAfter(TestInstance &test, TestResult &result)=0
Report finish of a test.
TestReporter::m_report
bool m_report
Report on/off.
Definition: TestReporter.h:130
TestReporter
Responsible for outputting test results.
Definition: TestReporter.h:35
List< TestInstance * >
TestCase.h
TestReporter::setStatistics
void setStatistics(bool value)
Set final statistics on/off.
Definition: TestReporter.cpp:57
TestReporter::getFailed
uint getFailed() const
Get fail count.
Definition: TestReporter.cpp:42
TestInstance
Represents a test instance.
Definition: TestInstance.h:35