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
125
127 char ** m_argv;
128
131
134
137
140};
141
147#endif /* __LIBTEST_TESTREPORTER_H */
Simple linked list template class.
Definition List.h:37
Represents a test instance.
Responsible for outputting test results.
void setMultiline(bool value)
Set multine mode on/off.
virtual ~TestReporter()
Destructor.
bool m_statistics
Final statistics on/off.
int m_argc
Argument count.
virtual void prepare(TestInstance &test)
Prepare for next test.
virtual void begin(List< TestInstance * > &tests)
Begin testing.
uint m_ok
Test statistics.
char ** m_argv
Argument values.
void setReport(bool value)
Set reporting on/off.
virtual void reportFinish(List< TestInstance * > &tests)=0
Report completion of all tests.
uint getFailed() const
Get fail count.
void setStatistics(bool value)
Set final statistics on/off.
virtual void reportAfter(TestInstance &test, TestResult &result)=0
Report finish of a test.
virtual void finish(List< TestInstance * > &tests)
Finish testing.
virtual void reportBefore(TestInstance &test)=0
Report start of a test.
uint getSkipped() const
Get skip count.
virtual void collect(TestInstance &test, TestResult &result)
Collect test statistics.
bool m_report
Report on/off.
uint getOk() const
Get OK count.
virtual void reportBegin(List< TestInstance * > &tests)=0
Report start of testing.
bool m_multiline
Multi line output.
Represents a Test result created by a TestInstance.
Definition TestResult.h:48
unsigned int uint
Unsigned integer number.
Definition Types.h:44