other_documentation.dox 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /**
  2. \mainpage
  3. \section _history History
  4. The first port of JUnit to C++ was done
  5. by Michael Feathers. His versions
  6. can be found on the
  7. <a href="http://www.xprogramming.com/software.htm">
  8. XProgramming software page</a>. They are os-specific,
  9. so Jerome Lacoste provided a port to Unix/Solaris.
  10. His version can be found on the same page.
  11. The %CppUnit project has combined and built on this work.
  12. \section _usage Usage
  13. Take a look into the \ref cppunit_cookbook.
  14. It gives a quick start into using this
  15. testing framework. <a href="modules.html">Modules</a> give
  16. you a organized view of %CppUnit classes.
  17. (Notes to newbies, you may want to check out \ref money_example,
  18. a work in progress, but the project is provided with %CppUnit).
  19. For a discussion on %CppUnit, check
  20. <a href="http://c2.com/cgi/wiki?CppUnit">
  21. the WikiWiki Pages on CppUnit</a>. There you can also
  22. find the original versions and various ports to other
  23. OSses and languages.
  24. \section _license License
  25. This library is released under
  26. the GNU
  27. <a href="http://www.gnu.org/copyleft/lesser.html">
  28. Lesser General Public License</a>.
  29. \author Eric Sommerlade ([email protected])
  30. \author Michael Feathers ([email protected])
  31. \author Jerome Lacoste ([email protected])
  32. \author Baptiste Lepilleur <[email protected]>
  33. \author Bastiaan Bakker <[email protected]>
  34. \author Steve Robbins <[email protected]>
  35. */
  36. /*! \defgroup WritingTestFixture Writing test fixture
  37. */
  38. /*! \defgroup Assertions Making assertions
  39. */
  40. /*! \defgroup CreatingTestSuite Creating TestSuite
  41. */
  42. /*! \defgroup ExecutingTest Executing test
  43. */
  44. /*! \defgroup TrackingTestExecution Tracking test execution
  45. */
  46. /*! \defgroup WritingTestResult Writing test result
  47. */
  48. /*! \defgroup BrowsingCollectedTestResult Browsing collected test result
  49. */
  50. /*! \defgroup CreatingNewAssertions Creating custom assertions
  51. */
  52. /*! \defgroup WritingTestPlugIn Writing Test Plug-in
  53. *
  54. * Creating a test plug-in is really simple:
  55. * - make your project a dynamic library (with VC++, choose Win32 Dynamic Library in
  56. * the project wizard), and link against the dynamic library version of %CppUnit
  57. * (cppunit*_dll.lib for VC++).
  58. * - in a cpp file, include TestPlugIn.h, and use the macro CPPUNIT_PLUGIN_IMPLEMENT()
  59. * to declare the test plug-in.
  60. * - That's it, you're done! All the tests registered using the TestFactoryRegistry,
  61. * CPPUNIT_TEST_SUITE_NAMED_REGISTRATION, or CPPUNIT_TEST_SUITE_REGISTRATION will
  62. * be visible to other plug-in and to the DllPlugInRunner.
  63. *
  64. * Example:
  65. * \code
  66. * #include <cppunit/include/plugin/TestPlugIn.h>
  67. *
  68. * CPPUNIT_PLUGIN_IMPLEMENT();
  69. * \endcode
  70. *
  71. * The interface CppUnitTestPlugIn is automatically implemented by the previous
  72. * macro. You can define your own implementation.
  73. *
  74. * To provide your custom implementation of the plug-in interface, you must:
  75. * - create a class that implements the CppUnitTestPlugIn interface
  76. * - use CPPUNIT_PLUGIN_EXPORTED_FUNCTION_IMPL() with your class to export
  77. * the plug-in interface
  78. * - implements the 'main' function with CPPUNIT_PLUGIN_IMPLEMENT_MAIN().
  79. *
  80. * Some of the reason you may want to do this:
  81. * - You do not use the TestFactoryRegistry to register your test.
  82. * - You want to create a custom listener to use with DllPlugInRunner.
  83. * - You want to do initialize some globale resources before running the test
  84. * (setting up COM for example).
  85. *
  86. * See CppUnitTestPlugIn for further detail on how to do this.
  87. *
  88. * Creating your own test plug-in with VC++:
  89. * - Create a new "Win32 Dynamic Library" project, choose the empty template
  90. * - For the Debug Configuration, add cppunitd_dll.lib to
  91. * 'Project Settings/Link/Object/Libariries modules', and for the Release
  92. * Configuration, add cppunit_dll.lib.
  93. * - For All Configuration, in 'C++/Preprocessor/Preprocessors definitions',
  94. * add the symbol 'CPPUNIT_DLL' at the end of the line (it means that
  95. * you are linking against cppunit dll).
  96. * - Create a 'main' file that contains:
  97. \verbatim
  98. #include <cppunit/plugin/TestPlugIn.h>
  99. CPPUNIT_PLUGIN_IMPLEMENT();\endverbatim
  100. * - Add your tests
  101. * - You're done !
  102. *
  103. * See examples/simple/simple_plugin.dsp for an example.
  104. *
  105. * Notes to VC++ users:
  106. * - you can run a post-build check on the plug-in. Add the following line to your
  107. * post-build tab: "DllPlugInTesterd_dll.exe $(TargetPath)". DllPlugInTesterd_dll.exe
  108. * need to be some place were it can be found (path, ...), or you need to
  109. * indicate the correct path.
  110. * $(TargetPath) is the filename of your plug-in.
  111. * - you can debug your DLL, set the executable for debug session to the plug-in
  112. * runner, and the name of the DLL in the program arguments ($(xxx) won't work
  113. * this time).
  114. *
  115. * How does it works ?
  116. *
  117. * When %CppUnit is linked as a DLL, the singleton used for the TestFactoryRegistry
  118. * is the same for the plug-in runner (also linked against %CppUnit DLL). This means
  119. * that the tests registered with the macros (at static initialization) are
  120. * registered in the same registry. As soon as a DLL is loaded by the PlugInManager,
  121. * the DLL static variable are constructed and the test registered to the
  122. * TestFactoryRegistry.
  123. *
  124. * After loading the DLL, the PlugInManager look-up a specific function exported by
  125. * the DLL. That function returns a pointer on the plug-in interface, which is later
  126. * used by the PlugInManager.
  127. *
  128. * \see CreatingTestSuite.
  129. */