summaryrefslogtreecommitdiff
path: root/doc/other_documentation.dox
blob: c935a7aed4715fe08df259abd4ec85bcf10d9451 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/**
 \mainpage
 
 \section _history History
 The first port of JUnit to C++ was done
 by Michael Feathers. His versions
 can be found on the 
 <a href="https://web.archive.org/web/20111230014200/http://www.xprogramming.com/software.htm">
 XProgramming software page</a>. They are os-specific,
 so Jerome Lacoste provided a port to Unix/Solaris.
 His version can be found on the same page.
 The %CppUnit project has combined and built on this work.

 \section _usage Usage
 Take a look into the \ref cppunit_cookbook.
 It gives a quick start into using this 
 testing framework. <a href="modules.html">Modules</a> give
 you a organized view of %CppUnit classes.

 (Notes to newbies, you may want to check out \ref money_example,
 a work in progress, but the project is provided with %CppUnit).

 For a discussion on %CppUnit, check 
 <a href="http://c2.com/cgi/wiki?CppUnit">
 the WikiWiki Pages on CppUnit</a>. There you can also
 find the original versions and various ports to other
 OSses and languages.

 \section _build Build
 If you want to build just this documentation, you will
 need to install `doxygen` and `graphviz`, then run:
 ~~~~~{.sh}
 git clone git://anongit.freedesktop.org/git/libreoffice/cppunit/
 cd cppunit
 ./autogen.sh
 ./configure
 cd doc
 make
 ~~~~~
 
 \section _license License
 This library is released under
 the GNU
 <a href="http://www.gnu.org/copyleft/lesser.html">
 Lesser General Public License</a>.

 \author Eric Sommerlade (sommerlade@gmx.net)
 \author Michael Feathers (mfeathers@objectmentor.com)
 \author Jerome Lacoste (lacostej@altern.org)
 \author Baptiste Lepilleur <blep@users.sourceforge.net>
 \author Bastiaan Bakker <bastiaan.bakker@lifeline.nl>
 \author Steve Robbins <smr99@sourceforge.net>
 */



/*! \defgroup WritingTestFixture Writing test fixture
 */

/*! \defgroup Assertions Making assertions
 */

/*! \defgroup CreatingTestSuite Creating TestSuite
 */

/*! \defgroup ExecutingTest Executing test
 */

/*! \defgroup TrackingTestExecution Tracking test execution
 */

/*! \defgroup WritingTestResult Writing test result
 */

/*! \defgroup BrowsingCollectedTestResult Browsing collected test result
 */

/*! \defgroup CreatingNewAssertions Creating custom assertions
 */

/*! \defgroup WritingTestPlugIn Writing Test Plug-in
 *
 * Creating a test plug-in is really simple:
 * - make your project a dynamic library (with VC++, choose Win32 Dynamic Library in
 *   the project wizard), and link against the dynamic library version of %CppUnit
 *   (cppunit*_dll.lib for VC++).
 * - in a cpp file, include TestPlugIn.h, and use the macro CPPUNIT_PLUGIN_IMPLEMENT()
 *   to declare the test plug-in.
 * - That's it, you're done! All the tests registered using the TestFactoryRegistry,
 *   CPPUNIT_TEST_SUITE_NAMED_REGISTRATION, or CPPUNIT_TEST_SUITE_REGISTRATION will
 *   be visible to other plug-in and to the DllPlugInRunner.
 *
 * Example:
 * \code
 * #include <cppunit/include/plugin/TestPlugIn.h>
 *
 * CPPUNIT_PLUGIN_IMPLEMENT();
 * \endcode
 *
 * The interface CppUnitTestPlugIn is automatically implemented by the previous
 * macro. You can define your own implementation.
 *
 * To provide your custom implementation of the plug-in interface, you must:
 * - create a class that implements the CppUnitTestPlugIn interface
 * - use CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL() with your class to export
 *   the plug-in interface
 * - implements the 'main' function with CPPUNIT_PLUGIN_IMPLEMENT_MAIN().
 *
 * Some of the reason you may want to do this:
 * - You do not use the TestFactoryRegistry to register your test.
 * - You want to create a custom listener to use with DllPlugInRunner.
 * - You want to do initialize some globale resources before running the test
 *   (setting up COM for example).
 *   
 * See CppUnitTestPlugIn for further detail on how to do this.
 *
 * Creating your own test plug-in with VC++:
 * - Create a new "Win32 Dynamic Library" project, choose the empty template
 * - For the Debug Configuration, add cppunitd_dll.lib to 
 *   'Project Settings/Link/Object/Libariries modules', and for the Release
 *   Configuration, add cppunit_dll.lib.
 * - For All Configuration, in 'C++/Preprocessor/Preprocessors definitions',
 *   add the symbol 'CPPUNIT_DLL' at the end of the line (it means that
 *   you are linking against cppunit dll).
 * - Create a 'main' file that contains:
\verbatim
#include <cppunit/plugin/TestPlugIn.h>

CPPUNIT_PLUGIN_IMPLEMENT();\endverbatim
 * - Add your tests
 * - You're done !
 *
 * See examples/simple/simple_plugin.vcproj for an example.
 *
 * Notes to VC++ users: 
 * - you can run a post-build check on the plug-in. Add the following line to your
 *   post-build tab: "DllPlugInTesterd_dll.exe $(TargetPath)". DllPlugInTesterd_dll.exe
 *   need to be some place were it can be found (path, ...), or you need to
 *   indicate the correct path. 
 *   $(TargetPath) is the filename of your plug-in.
 * - you can debug your DLL, set the executable for debug session to the plug-in 
 *   runner, and the name of the DLL in the program arguments ($(xxx) won't work
 *   this time).
 *
 * How does it works ?
 *
 * When %CppUnit is linked as a DLL, the singleton used for the TestFactoryRegistry
 * is the same for the plug-in runner (also linked against %CppUnit DLL). This means
 * that the tests registered with the macros (at static initialization) are 
 * registered in the same registry. As soon as a DLL is loaded by the PlugInManager,
 * the DLL static variable are constructed and the test registered to the 
 * TestFactoryRegistry.
 *
 * After loading the DLL, the PlugInManager look-up a specific function exported by
 * the DLL. That function returns a pointer on the plug-in interface, which is later
 * used by the PlugInManager.
 *
 * \see CreatingTestSuite.
 */