added tech note about writing unit tests
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25820 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
2cc0718168
commit
4f09729dfb
@ -17,6 +17,7 @@ tn0013.txt How to make a wxGTK distribution
|
|||||||
tn0014.txt XRC resources format specification
|
tn0014.txt XRC resources format specification
|
||||||
tn0015.txt How to add new bitmaps to wxWindows UI elements
|
tn0015.txt How to add new bitmaps to wxWindows UI elements
|
||||||
tn0016.txt How to add new files and libraries to wxWindows build system
|
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$
|
||||||
|
43
docs/tech/tn0017.txt
Normal file
43
docs/tech/tn0017.txt
Normal file
@ -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$
|
Loading…
Reference in New Issue
Block a user