]> git.saurik.com Git - wxWidgets.git/commitdiff
added tech note about writing unit tests
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 15 Feb 2004 15:43:42 +0000 (15:43 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 15 Feb 2004 15:43:42 +0000 (15:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25820 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/tech/index.txt
docs/tech/tn0017.txt [new file with mode: 0644]

index f1d66f5f187a9355e3019b6aedad78c41fc468e7..1e318a03aa9fa4e64d8d7ed3ebb35b34f3d002a3 100644 (file)
@@ -17,6 +17,7 @@ tn0013.txt   How to make a wxGTK distribution
 tn0014.txt   XRC resources format specification
 tn0015.txt   How to add new bitmaps to wxWindows UI elements
 tn0016.txt   How to add new files and libraries to wxWindows build system
 tn0014.txt   XRC resources format specification
 tn0015.txt   How to add new bitmaps to wxWindows UI elements
 tn0016.txt   How to add new files and libraries to wxWindows build system
+tn0017.txt   How to write unit tests for wxWindows classes
 
 
 Version: $Id$
 
 
 Version: $Id$
diff --git a/docs/tech/tn0017.txt b/docs/tech/tn0017.txt
new file mode 100644 (file)
index 0000000..e6aa484
--- /dev/null
@@ -0,0 +1,43 @@
+                    How to write unit tests for wxWindows
+                    =====================================
+
+ Unit tests for wxWindows are written using small cppunit framework. To compile
+(but not to run) them you need to have it installed. Hence the first part of
+this note exlpains how to do it while the second one explains how to write the
+test.
+
+I. CppUnit Installation
+-----------------------
+
+1. Get it from http://www.sourceforge.net/projects/cppunit
+   (latest version as of the time of this writing is 1.8.0)
+
+2. Build the library:
+ a) Under Windows using VC++ (both versions 6 and 7 work):
+    - build everything in CppUnitLibraries.dsw work space
+    - add include and lib subdirectories of the directory
+      where you installed cppunit to the compiler search path
+      using "Tools|Options" menu in VC IDEA
+
+ b) Under Unix: run configure && make && make install as usual
+
+
+II. Writing tests with CppUnit
+------------------------------
+
+1. Create a new directory tests/foo
+
+2. Write the main.cpp file for the test program copying, if you want,
+   from one of the existing tests. The things to look for:
+ a) #include "wx/cppunit.h" instead of directly including CppUnit headers
+ b) don't put too many things in one test case nor in one method of a test
+    case as it makes understanding what exactly failed harder later
+
+   Read CppUnit documentation for more.
+
+3. Write a bakefile for the new test (again, copy an existing one...)
+
+=== EOF ===
+
+Author:  VZ
+Version: $Id$