Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members  

D:/new/wxTest/include/wxTest/TestRunner.h

Go to the documentation of this file.
00001 

00002 // Name:        TestRunner.h

00003 // Purpose:     Provide default implementation for the test runner interface wxITestRunner

00004 // Author:      Marty Saxton

00005 // Modified by:

00006 // Created:     10/27/2001

00007 // RCS-ID:      $Id: TestRunner_8h-source.html,v 1.1.1.1 2001/11/10 19:00:39 thundercow Exp $

00008 // Copyright:   (c) Marty Saxton, Thundercow Software

00009 // Licence:     wxWindows license

00011 

00012 #include <wx/wxprec.h>

00013 #ifndef WX_PRECOMP

00014 #       include <wx/wx.h>

00015 #endif

00016 

00017 #include <wxTest/TestSuite.h>

00018 #include <wxTest/ITestRunner.h>

00019 #include <stdio.h>

00020 

00021 struct wxTestModule;

00022 class wxDynamicLibrary;

00023 

00024 struct wxTestModule

00025 {

00026         wxDynamicLibrary * m_pLib;

00027         wxString m_strModuleFileName;

00028         wxITest* m_pTest;

00029         typedef wxITest* (*GetWXTestsFunc)();

00030         GetWXTestsFunc m_pTestFunc;

00031 };

00032 

00033 

00034 class wxTestRunner : public wxITestRunner

00035 {

00036 public:

00037         wxTestRunner();

00038         virtual ~wxTestRunner();

00039 

00040 

00046         virtual void wxtstdout( const char* psz, ... );

00047 

00051         virtual void BeginTestCase( wxITest* pTest );

00052 

00056         virtual void EndTestCase( wxITest* pTest );

00057 

00058         virtual void OnTestFailure( wxITest* pTest, const char* pszMessage, const char* pszFile, unsigned long nLineNo ); 

00059 

00060         virtual wxString GetQualifiedTestDescription( wxITest* pTest );

00061 

00062         virtual void LoadTests();

00063 

00064         virtual void OnFoundTestModule( wxTestModule& pTest );

00065 

00066         virtual void OnTestAdded( wxITest* pTest );

00067 

00068         virtual void SpawnThreads( wxITest* );

00069         virtual void BeginTests();

00070 

00071 

00072         virtual void OnTestOutput( wxITest* pTest, const char* pszOutput );

00073         virtual void OnErrorOutput( const char* pszOutput );

00074 

00075         virtual int GetNumTestsRun();

00076 

00077         virtual int GetNumFailures();

00078 

00079         wxITest* GetTestRoot();

00080 

00081         virtual void GetOutputSubdir( wxITest* pTest, char* pszBuffer, bool bCreate );

00082 

00083         virtual wxString GetOutputSubdir(); 

00084         virtual void SetOutputSubDir( wxString strNewOutputSubDir );

00085 

00086 

00087 protected:

00088 

00089         virtual void OpenFiles( wxITest* pTest );

00090         virtual void CloseFiles();

00091         FILE* m_stdout;

00092         wxITest *m_pCurrentTest;

00093 

00094 

00095         wxTestModule* m_modules;

00096         int m_nModuleCount;

00097         int m_nModuleCapacity;

00098 

00099         int m_nFailures;

00100         int m_nFailuresThisTestCase;

00101         int m_nTestsRun;

00102         wxString m_strLibDir;

00103         wxString m_strOutputDir;

00104         wxTestSuite* m_pRootTest;

00105 };

00106 

00107 class TestRunnerThread;

00108 

00109 class wxTestRunnerMT : public wxTestRunner

00110 {

00111 public:

00112         wxTestRunnerMT();

00113         virtual ~wxTestRunnerMT();

00114         void SetNumThreads( int nThreads );

00115         virtual void OnThreadTerminated( TestRunnerThread* pThread );

00116         int m_nThreads;

00117         virtual void SpawnThreads( wxITest* );

00118 protected:

00119         TestRunnerThread** m_threads;

00120 };


ThunderCow Software (c) 2001 Marty Saxton, ThunderCow Software. Generated on Sat Nov 10 12:07:18 2001 for wxTest by Doxygen 1.2.11