From 4f09729dfb63907ee07fc9395ff47f6411eb7469 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 15 Feb 2004 15:43:42 +0000 Subject: [PATCH] added tech note about writing unit tests git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25820 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/tech/index.txt | 1 + docs/tech/tn0017.txt | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 docs/tech/tn0017.txt diff --git a/docs/tech/index.txt b/docs/tech/index.txt index f1d66f5f18..1e318a03aa 100644 --- a/docs/tech/index.txt +++ b/docs/tech/index.txt @@ -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 +tn0017.txt How to write unit tests for wxWindows classes Version: $Id$ diff --git a/docs/tech/tn0017.txt b/docs/tech/tn0017.txt new file mode 100644 index 0000000000..e6aa48491c --- /dev/null +++ b/docs/tech/tn0017.txt @@ -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$ -- 2.45.2