Vault  4.1
vunit.h
Go to the documentation of this file.
00001 /*
00002 Copyright c1997-2014 Trygve Isaacson. All rights reserved.
00003 This file is part of the Code Vault version 4.1
00004 http://www.bombaydigital.com/
00005 License: MIT. See LICENSE.md in the Vault top level directory.
00006 */
00007 
00008 #ifndef vunit_h
00009 #define vunit_h
00010 
00013 /*
00014 Not trying to build an xUnit facility here, nor interface with one,
00015 just defining a trivial unit test base class from which I can derive
00016 unit tests and regression tests for various testable classes and APIs
00017 in the Vault.
00018 */
00019 
00020 #include "vtypes.h"
00021 #include "vstring.h"    // not needed by this header, but needed by all subclasses
00022 #include "vinstant.h"
00023 #include "vchar.h"
00024 #include "vcolor.h"
00025 
00026 class VLogAppender;
00027 class VLogger;
00028 class VTextIOStream;
00029 
00034 class VTestInfo {
00035     public:
00036 
00037         VTestInfo(bool success, const VString& description, const VDuration& duration);
00038         ~VTestInfo() {}
00039 
00040         bool        mSuccess;       
00041         VString     mDescription;   
00042         VDuration   mDuration;      
00043 };
00044 
00045 typedef std::vector<VTestInfo> TestInfoVector;
00046 
00047 class VUnitOutputWriter;
00048 typedef std::vector<VUnitOutputWriter*> VUnitOutputWriterList;
00049 
00050 typedef std::vector<VLogAppender*> VUnitLogAppenderList;
00051 
00063 class VUnitOutputWriter {
00064     public:
00065 
00082         static void createOutputWriters(const VStringVector& args, VUnitOutputWriterList& writers, VUnitLogAppenderList& appenders);
00083 
00084         VUnitOutputWriter(VLogAppender& outputAppender);
00085         virtual ~VUnitOutputWriter() {}
00086 
00087         virtual void testSuitesBegin() = 0;
00088         virtual void testSuiteBegin(const VString& testSuiteName) = 0;
00089         virtual void testSuiteStatusMessage(const VString& message) = 0;
00090         virtual void testCaseBegin(const VString& testCaseName) = 0;
00091         virtual void testCaseEnd(const VTestInfo& testInfo) = 0;
00092         virtual void testSuiteEnd() = 0;
00093         virtual void testSuitesEnd() = 0;
00094 
00095     protected:
00096 
00097         // The concrete classes must call these helper functions
00098         // from their corresponding interface implementations, to manage the data.
00099         void _testSuitesBegin();
00100         void _testSuiteBegin(const VString& testSuiteName);
00101         void _testCaseBegin(const VString& testCaseName);
00102         void _testCaseEnd(const VTestInfo& testInfo);
00103         void _testSuiteEnd();
00104 
00105         VLogAppender& mLogAppender;
00106         VInstant mTestSuitesStartTime;
00107         int mTotalNumSuccesses;
00108         int mTotalNumErrors;
00109         VString mCurrentTestSuiteName;
00110         TestInfoVector mCurrentTestSuiteResults;
00111         int mCurrentTestSuiteNumSuccesses;
00112         int mCurrentTestSuiteNumErrors;
00113         VInstant mCurrentTestSuiteStartTime;
00114         VInstant mCurrentTestSuiteEndTime;
00115         VString mCurrentTestCaseName;
00116         VInstant mCurrentTestCaseStartTime;
00117         VInstant mCurrentTestCaseEndTime;
00118         VStringVector mFailedTestSuiteNames;
00119 
00120     private:
00121 
00122         // Prevent copy construction and assignment since there is no provision for cloning this class.
00123         VUnitOutputWriter(const VUnitOutputWriter& other);
00124         VUnitOutputWriter& operator=(const VUnitOutputWriter& other);
00125 
00126         // These are the functions used by createOutputWriters().
00127         static VLogAppender* _newLogAppenderByType(const VString& outputType, const VString& filePath);
00128         static VUnitOutputWriter* _newOutputWriterByType(const VString& outputType, VLogAppender* logAppender);
00129         static void _addNewOutputWriter(VUnitOutputWriterList& outputters, VUnitLogAppenderList& outpuAppenders, const VString& outputType, const VString& filePath);
00130 };
00131 
00146 class VUnit {
00147     public:
00148 
00154         static void runUnit(VUnit& unit, VUnitOutputWriterList* writers);
00160         static void rerunUnit(VUnit& unit, VUnitOutputWriterList* writers);
00161 
00168         VUnit(const VString& name, bool logOnSuccess, bool throwOnError);
00172         virtual ~VUnit();
00173 
00180         void setWriters(VUnitOutputWriterList* writers) { mWriters = writers; }
00181 
00185         virtual void run() = 0;
00190         virtual void reset();
00191 
00196         const VString& getName() const { return mName; }
00201         bool success() { return mNumFailedTests == 0; }
00206         int getNumSuccessfulTests() { return mNumSuccessfulTests; }
00211         int getNumFailedTests() { return mNumFailedTests; }
00212 
00213         // These functions are used by the runUnit() static function.
00214 
00215         void logStart();
00216         void logNormalEnd();
00217         void logExceptionalEnd(const VString& exceptionMessage);
00218 
00219     protected:
00220 
00221         VString                 mName;          
00222         bool                    mLogOnSuccess;  
00223         bool                    mThrowOnError;  
00224         VUnitOutputWriterList*  mWriters;       
00225 
00226 #define VUNIT_ASSERT_SUCCESS(suffix) this->assertSuccess(suffix, __FILE__, __LINE__)
00227 #define VUNIT_ASSERT_FAILURE(suffix) this->assertFailure(suffix, __FILE__, __LINE__)
00228         void assertSuccess(const VString& labelSuffix, const VString& filePath, int lineNumber);
00229         void assertFailure(const VString& labelSuffix, const VString& filePath, int lineNumber);
00230 
00231         // These are the methods that test equality of two values of the same type.
00232 #define VUNIT_ASSERT_EQUAL(a, b) this->assertEqual(a, b, VString::EMPTY(), __FILE__, __LINE__)
00233 #define VUNIT_ASSERT_EQUAL_LABELED(a, b, suffix) this->assertEqual(a, b, suffix, __FILE__, __LINE__)
00234 #define VUNIT_ASSERT_TRUE(v) this->assertTrue(v, VString::EMPTY(), __FILE__, __LINE__)
00235 #define VUNIT_ASSERT_TRUE_LABELED(v, suffix) this->assertTrue(v, suffix, __FILE__, __LINE__)
00236         void assertTrue(bool b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(b, filePath, lineNumber, labelSuffix, VString("failed assertion: value is false but should be true")); }
00237         void assertEqual(int a, int b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %d == %d", a, b)); }
00238         void assertEqual(unsigned int a, unsigned int b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %ud == %ud", a, b)); }
00239         void assertEqual(long a, long b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %ld == %ld", a, b)); }
00240         void assertEqual(bool a, bool b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %s == %s", (a ? "true" : "false"), (b ? "true" : "false"))); }
00241         void assertEqual(const VString& a, const VString& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: '%s' == '%s'", a.chars(), b.chars())); }
00242         void assertEqual(const VString& a, const char* b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: '%s' == '%s'", a.chars(), b)); }
00243         void assertEqual(const VCodePoint& a, const VCodePoint& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: '%s' == '%s'", a.toString().chars(), b.toString().chars())); }
00244         void assertEqual(const char* a, const VString& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: '%s' == '%s'", a, b.chars())); }
00245         void assertEqual(const VChar& a, const VChar& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: '%c' == '%c'", a.charValue(), b.charValue())); }
00246         void assertEqual(const VChar& a, char b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: '%c' == '%c'", a.charValue(), b)); }
00247         void assertEqual(VDouble a, VDouble b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %lf == %lf", a, b)); }
00248         void assertEqual(const VDuration& a, const VDuration& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %lldms == %lldms", a.getDurationMilliseconds(), b.getDurationMilliseconds())); }
00249         void assertEqual(const VInstant& a, const VInstant& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %lld == %lld", a.getValue(), b.getValue())); }
00250         void assertEqual(Vs8 a, Vs8 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %hhd == %hhd", a, b)); }
00251         void assertEqual(Vu8 a, Vu8 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %hhu == %hhu", a, b)); }
00252         void assertEqual(Vs16 a, Vs16 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %hd == %hd", a, b)); }
00253         void assertEqual(Vu16 a, Vu16 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %hu == %hu", a, b)); }
00254 
00255         void assertEqual(char a, char b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %d == %d", a, b)); }
00256 
00257 #ifndef Vx32_IS_xINT /* don't redefine if types are same */
00258         void assertEqual(Vs32 a, Vs32 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %ld == %ld", a, b)); }
00259         void assertEqual(Vu32 a, Vu32 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %lu == %lu", a, b)); }
00260 #endif /* not Vx32_IS_xINT */
00261 
00262 #ifndef Vx64_IS_xINT /* don't redefine if types are same */
00263         void assertEqual(Vs64 a, Vs64 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %lld == %lld", a, b)); }
00264         void assertEqual(Vu64 a, Vu64 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %llu == %llu", a, b)); }
00265 #endif /* not Vx64_IS_xINT */
00266 
00267 #ifndef V_SIZE_T_IS_UNSIGNED_INT /* don't redefine if types are same */
00268         void assertEqual(size_t a, size_t b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: " VSTRING_FORMATTER_SIZE " == " VSTRING_FORMATTER_SIZE, a, b)); }
00269 #endif /* not V_SIZE_T_IS_UNSIGNED_INT */
00270 
00271         void assertEqual(const VColor& a, const VColor& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %s == %s", a.getCSSColor().chars(), b.getCSSColor().chars())); }
00272         void assertEqual(const VColorPair& a, const VColorPair& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a == b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %s == %s", a.getCSSColor().chars(), b.getCSSColor().chars())); }
00273 #define VUNIT_ASSERT_NOT_EQUAL(a, b) this->assertNotEqual(a, b, VString::EMPTY(), __FILE__, __LINE__)
00274 #define VUNIT_ASSERT_NOT_EQUAL_LABELED(a, b, suffix) this->assertNotEqual(a, b, suffix, __FILE__, __LINE__)
00275 #define VUNIT_ASSERT_FALSE(v) this->assertFalse(v, VString::EMPTY(), __FILE__, __LINE__)
00276 #define VUNIT_ASSERT_FALSE_LABELED(v, suffix) this->assertFalse(v, suffix, __FILE__, __LINE__)
00277         void assertFalse(bool b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(!b, filePath, lineNumber, labelSuffix, VString("failed assertion: value is true but should be false")); }
00278         void assertNotEqual(int a, int b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: %d != %d", a, b)); }
00279         void assertNotEqual(unsigned int a, unsigned int b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: %ud != %ud", a, b)); }
00280         void assertNotEqual(long a, long b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: %ld != %ld", a, b)); }
00281         void assertNotEqual(bool a, bool b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: %s != %s", (a ? "true" : "false"), (b ? "true" : "false"))); }
00282         void assertNotEqual(const VString& a, const VString& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: '%s' != '%s'", a.chars(), b.chars())); }
00283         void assertNotEqual(const VString& a, const char* b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: '%s' != '%s'", a.chars(), b)); }
00284         void assertNotEqual(const VCodePoint& a, const VCodePoint& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: '%s' != '%s'", a.toString().chars(), b.toString().chars())); }
00285         void assertNotEqual(const char* a, const VString& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: '%s' != '%s'", a, b.chars())); }
00286         void assertNotEqual(const VChar& a, const VChar& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: '%c' != '%c'", a.charValue(), b.charValue())); }
00287         void assertNotEqual(const VChar& a, char b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: '%c' != '%c'", a.charValue(), b)); }
00288         void assertNotEqual(VDouble a, VDouble b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: %lf != %lf", a, b)); }
00289         void assertNotEqual(const VDuration& a, const VDuration& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: %lldms != %lldms", a.getDurationMilliseconds(), b.getDurationMilliseconds())); }
00290         void assertNotEqual(const VInstant& a, const VInstant& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: %lld != %lld", a.getValue(), b.getValue())); }
00291         void assertNotEqual(Vs8 a, Vs8 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: %hhd != %hhd", a, b)); }
00292         void assertNotEqual(Vu8 a, Vu8 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: %hhu != %hhu", a, b)); }
00293         void assertNotEqual(Vs16 a, Vs16 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: %hd != %hd", a, b)); }
00294         void assertNotEqual(Vu16 a, Vu16 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: %hu != %hu", a, b)); }
00295 
00296 #ifndef Vx32_IS_xINT /* don't redefine if types are same */
00297         void assertNotEqual(Vs32 a, Vs32 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: %ld != %ld", a, b)); }
00298         void assertNotEqual(Vu32 a, Vu32 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: %lu != %lu", a, b)); }
00299 #endif /* not Vx32_IS_xINT */
00300 
00301 #ifndef Vx64_IS_xINT /* don't redefine if types are same */
00302         void assertNotEqual(Vs64 a, Vs64 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: %lld != %lld", a, b)); }
00303         void assertNotEqual(Vu64 a, Vu64 b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: %llu != %llu", a, b)); }
00304 #endif /* not Vx64_IS_xINT */
00305 
00306 #ifndef V_SIZE_T_IS_UNSIGNED_INT /* don't redefine if types are same */
00307         void assertNotEqual(size_t a, size_t b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed inequality: " VSTRING_FORMATTER_SIZE " != " VSTRING_FORMATTER_SIZE, a, b)); }
00308 #endif /* not V_SIZE_T_IS_UNSIGNED_INT */
00309 
00310         void assertNotEqual(const VColor& a, const VColor& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %s != %s", a.getCSSColor().chars(), b.getCSSColor().chars())); }
00311         void assertNotEqual(const VColorPair& a, const VColorPair& b, const VString& labelSuffix, const VString& filePath, int lineNumber) { this->testAssertion(a != b, filePath, lineNumber, labelSuffix, VSTRING_FORMAT("failed equality: %s != %s", a.getCSSColor().chars(), b.getCSSColor().chars())); }
00312 
00313 #define VUNIT_ASSERT_NULL(ptrValue) this->assertTrue(ptrValue == NULL, VString::EMPTY(), __FILE__, __LINE__)
00314 #define VUNIT_ASSERT_NULL_LABELED(ptrValue, suffix) this->assertTrue(ptrValue == NULL, suffix, __FILE__, __LINE__)
00315 #define VUNIT_ASSERT_NOT_NULL(ptrValue) this->assertFalse(ptrValue == NULL, VString::EMPTY(), __FILE__, __LINE__)
00316 #define VUNIT_ASSERT_NOT_NULL_LABELED(ptrValue, suffix) this->assertFalse(ptrValue == NULL, suffix, __FILE__, __LINE__)
00317 
00318 #define VUNIT_ASSERT_EQUAL_LABELED(a, b, suffix) this->assertEqual(a, b, suffix, __FILE__, __LINE__)
00319 
00329         virtual void testAssertion(bool success, const VString& filePath, int lineNumber, const VString& labelSuffix, const VString& expectedDescription);
00336         virtual void test(bool success, const VString& description);
00343         virtual void test(const VString& a, const VString& b, const VString& description);
00349         void logStatus(const VString& description);
00350 
00351     private:
00352 
00353         // It does not make sense to copy/assign VUnit objects; the mWriters would have to be cloned or safely copied.
00354         VUnit(const VUnit&);
00355         void operator=(const VUnit&);
00356 
00357         void recordSuccess(const VString& description);
00358         void recordFailure(const VString& description);
00359 
00360         int             mNumSuccessfulTests;        
00361         int             mNumFailedTests;            
00362         TestInfoVector  mResults;                   
00363         Vs64            mUnitStartTimeSnapshot;     
00364         Vs64            mPreviousTestEndedSnapshot; 
00365         VString         mLastTestDescription;       
00366 };
00367 
00374 class VTestRunner {
00375     public:
00376 
00377         VTestRunner() {}
00378         virtual ~VTestRunner() {}
00379 
00380         virtual void runUnit(VUnit& unit, VUnitOutputWriterList* output) = 0;
00381 };
00382 
00387 class VTestSuitesWrapper {
00388     public:
00389 
00390         VTestSuitesWrapper(const VStringVector& args);
00391         virtual ~VTestSuitesWrapper();
00392 
00393         VUnitOutputWriterList   mWriters;
00394         VUnitLogAppenderList    mAppenders;
00395 };
00396 
00406 class VFailureEmitter : public VUnit {
00407     public:
00408 
00409         VFailureEmitter(const VString& testName, bool logOnSuccess, bool throwOnError, const VString& errorMessage);
00410         virtual ~VFailureEmitter() {}
00411 
00412         virtual void run();
00413 
00414     protected:
00415 
00416         VString fErrorMessage;
00417 };
00418 
00425 class VUnitJUnitXMLOutput : public VUnitOutputWriter {
00426     public:
00427 
00428         VUnitJUnitXMLOutput(VLogAppender& outputAppender);
00429         virtual ~VUnitJUnitXMLOutput() {}
00430 
00431         virtual void testSuitesBegin();
00432         virtual void testSuiteBegin(const VString& testSuiteName);
00433         virtual void testSuiteStatusMessage(const VString& message);
00434         virtual void testCaseBegin(const VString& testCaseName);
00435         virtual void testCaseEnd(const VTestInfo& testInfo);
00436         virtual void testSuiteEnd();
00437         virtual void testSuitesEnd();
00438 };
00439 
00445 class VUnitSimpleTextOutput : public VUnitOutputWriter {
00446     public:
00447 
00448         VUnitSimpleTextOutput(VLogAppender& outputAppender);
00449         virtual ~VUnitSimpleTextOutput() {}
00450 
00451         virtual void testSuitesBegin();
00452         virtual void testSuiteBegin(const VString& testSuiteName);
00453         virtual void testSuiteStatusMessage(const VString& message);
00454         virtual void testCaseBegin(const VString& testCaseName);
00455         virtual void testCaseEnd(const VTestInfo& testInfo);
00456         virtual void testSuiteEnd();
00457         virtual void testSuitesEnd();
00458 };
00459 
00465 class VUnitTeamCityOutput : public VUnitOutputWriter {
00466     public:
00467 
00468         VUnitTeamCityOutput(VLogAppender& outputAppender);
00469         virtual ~VUnitTeamCityOutput() {}
00470 
00471         virtual void testSuitesBegin();
00472         virtual void testSuiteBegin(const VString& testSuiteName);
00473         virtual void testSuiteStatusMessage(const VString& message);
00474         virtual void testCaseBegin(const VString& testCaseName);
00475         virtual void testCaseEnd(const VTestInfo& testInfo);
00476         virtual void testSuiteEnd();
00477         virtual void testSuitesEnd();
00478 };
00479 
00484 class VUnitTeamCityBuildStatusOutput : public VUnitOutputWriter {
00485     public:
00486 
00487         VUnitTeamCityBuildStatusOutput(VLogAppender& outputAppender);
00488         virtual ~VUnitTeamCityBuildStatusOutput() {}
00489 
00490         virtual void testSuitesBegin();
00491         virtual void testSuiteBegin(const VString& testSuiteName);
00492         virtual void testSuiteStatusMessage(const VString& message);
00493         virtual void testCaseBegin(const VString& testCaseName);
00494         virtual void testCaseEnd(const VTestInfo& testInfo);
00495         virtual void testSuiteEnd();
00496         virtual void testSuitesEnd();
00497 };
00498 
00499 #endif /* vunit_h */

Copyright ©1997-2014 Trygve Isaacson. All rights reserved. This documentation was generated with Doxygen.