1 How to write unit tests for wxWindows
2 =====================================
4 Unit tests for wxWindows are written using small cppunit framework. To compile
5 (but not to run) them you need to have it installed. Hence the first part of
6 this note exlpains how to do it while the second one explains how to write the
9 I. CppUnit Installation
10 -----------------------
12 1. Get it from http://www.sourceforge.net/projects/cppunit
13 (latest version as of the time of this writing is 1.8.0)
16 a) Under Windows using VC++ (both versions 6 and 7 work):
17 - build everything in CppUnitLibraries.dsw work space
18 - add include and lib subdirectories of the directory
19 where you installed cppunit to the compiler search path
20 using "Tools|Options" menu in VC IDEA
22 b) Under Unix: run configure && make && make install as usual
25 II. Writing tests with CppUnit
26 ------------------------------
28 1. Create a new directory tests/foo
30 2. Write the main.cpp file for the test program copying, if you want,
31 from one of the existing tests. The things to look for:
32 a) #include "wx/cppunit.h" instead of directly including CppUnit headers
33 b) don't put too many things in one test case nor in one method of a test
34 case as it makes understanding what exactly failed harder later
36 Read CppUnit documentation for more.
38 3. Write a bakefile for the new test (again, copy an existing one...)