2 EasyUnit : Simple C++ Unit testing framework
3 Copyright (C) 2004 Barthelemy Dagenais
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 barthelemy@prologique.com
23 #ifndef DEFAULTTESTPRINTER_H
24 #define DEFAULTTESTPRINTER_H
26 #include "testprinter.h"
29 #include "testresult.h"
34 * Complete header level means that a header will be printed
35 * before the test details with all information available in
38 * Normal header level means that a header will be printed
39 * before the test details with the most useful information
40 * available in the test result.
42 * Off header level means that no header will be printed
43 * before the test details.
45 * Whatever the level, there will always be a clear indication
46 * telling if there was a failure/error or not at the global
49 enum headerLevel
{complete
,normal
,off
};
52 * This is the default testprinter used by easyunit testregistry
53 * when the user calls the runAndPrint() method without specifying
56 * This testprinter writes plain text result to any supplied file.
57 * The default file is the standard output.
59 * You may customize the outpur format by specifying the header level
60 * and if you wish the testprinter to print details about each success.
62 * The default header level is normal and by default, the testprinter
63 * does not print details about each success.
65 class DefaultTestPrinter
: public TestPrinter
70 * Default constructor that sets the header level
71 * to normal and the output source to the standard
79 virtual ~DefaultTestPrinter();
81 * Prints a header depending of the header level and
82 * details about each test to the output_.
84 * @param testResult Results of all tests that were ran.
86 virtual void print(const TestResult
*testResult
);
89 * Set the header level of the printer.
91 * @param level Header level that will be used during print()
93 void setHeaderLevel(headerLevel level
);
96 * Set whether or not the printer should display the details
97 * of test that succeeded.
99 * @param show Set to true to display details about success
101 void showSuccessDetail(bool show
);
104 * Set the output to which the printer will print results.
106 * @param output Output used to print the results
108 void setOutput(FILE *output
);
111 virtual void printHeader(const TestResult
*testResult
);
112 virtual void printTests(TestCase
*testCase
);
113 virtual void printResults(Test
*test
);
114 virtual void printCompleteHeader(const TestResult
*testResult
);
115 virtual void printNormalHeader(const TestResult
*testResult
);
117 int testFailuresTotal_
;
120 bool showSuccessDetail_
;
124 #endif // DEFAULTTESTPRINTER_H