CPPUnit - Win32 platform installation instructions

xiaoxiao2021-03-06  103

Appendix - Win32 platform installation instructions

Currently, CPPUnit supports only Microsoft Visual C under Win32 platform, and your VC compiler should be at least 6.0. The steps to compile the run sample program using the GUI TESTRUNNER:

Open Examples / Examples.dsw in VC (including all examples) Select Tools / Customize ... / add-insids / customize ... / add-insids / customize ... / add-insids / customize ... / add-insidin .dll file, and press OK to register this add--ins) Run Project [Project Creation Results] Framework & Tool:

CPPUNIT (CPPUNIT.LIB): The frame library of unit testing, you will use it to write unit tests. CPPUNIT_DLL (CPPUNIT_DLL.DLL / LIB): In the same, it is only rendered in a DLL mode. Testrunner (Testrunner.dll): An MFC extension DLL used to run unit testing and view results in GUI mode. DSPLUGIN (LIB / TESTRUNNERDSPLUGIN.DLL): A VC add-on, used for Testrunner.dll. With it, if you double-click a Failure in the MFC Testrunner, you will start VC , open the file where Failure is located and locate it. TestPluginRunner: (Warning: Experimental) A VC application to run the test plugin. The test plugin is a DLL that is openly specific interface. The application is currently not completed (Auto-Reload "is lost). All library files are placed in a lib / directory. [Example]

CPPUNITTESTMAIN: A actual test package (Test Suite) is used to test CPPUnit. Using the TextTestrunner (a unit test environment of a text), POST-Build Testing is used to use CompilterOutputTer (that is, taking testing after compiling). Set a static library and dynamic library that connects CPPUnit in the configuration. CPPUnitTestApp: The same test package as cppUnittestMain, but uses MFC Testrunner (GUI mode unit test environment) Hierarchy: An example of how subcatenified test (you may be more willing to use Helpermacros.h and macro cppunit_test_sub_suite, this The way is more concise. This example has not been updated for a long time). Hostapp: An example of a variety of failure tests with MFC Testrunner. MFC Unicode Testrunner also demonstrated. TestPlugin: A demo example (experimental) for testPluginRunner (experimental)] CPPUNIT and TESTRunner have three configurations.

Release (): multi-threaded DLL, Release mode Debug (D): debug multithreaded DLL, Debug mode Unicode Release (U): Unicode multi-thread DLL, Release mode Unicode Debug (UD): Unicode Debug multi-thread DLL, Debug mode Debug CrossPlatform (CD): Debug Multithreaded DLL, does not use Type_info from the package name of the test case from the class name. For CPPUnit, when the DLL is created, the alphabet "DLL" will be added to the suffix. The letters in parentheses indicate the suffix after adding to the library name. For example, the CPPUnit static library configured by Debug is cppUnitd.lib. Debug configured CPPUnit dynamic library named cppunitd_dll.lib. [Creating] Opens the SRC / CPPUnitlibraries.dsw workspace file in VC . Set TestPluginRunner to Active Project. Select 'Batch Build ...' in the 'Build' menu in the Batch Build dialog box, select all Project and press the build button. All library files can be found in the lib / directory. [Testing]

Open Workspace Files Examples / Examples.dsw. Set CPPUnitTestApp to Active Project. Select the appropriate configuration for the library you want to create. Compilation Project. Testrunner GUI will appear. [Libraries] All compiled libraries can be found in the 'lib' directory. Multi-libraries can be created in the SRC / CPPUnitlibraries.dsw workspace. LIB /:

cppunit.lib: CppUnit static library "Multithreaded DLL" cppunitd.lib: CppUnit static library "Debug Multithreaded DLL" cppunit_dll.dll: CppUnit dynamic library (DLL) "Multithreaded DLL" cppunit_dll.lib: CppUnit dynamic import library "Multithreaded DLL" cppunitd_dll .dll: CppUnit dynamic library (DLL) "Debug Multithreaded DLL" cppunitd_dll.lib: CppUnit dynamic import library "Debug Multithreaded DLL" qttestrunner.dll: QT TestRunner dynamic link library (DLL) "Multithreaded DLL" qttestrunner.lib: QT TestRunner import library "Multithreaded DLL" testrunner.dll: MFC TestRunner dynamic link library (DLL) "Multithreaded DLL" testrunner.lib: MFC TestRunner import library "Multithreaded DLL" testrunnerd.dll: MFC TestRunner dynamic link library (DLL) "Debug Multithreaded DLL" testrunnerd.lib : MFC TestRunner import library "Debug Multithreaded DLL" testrunneru.dll: MFC Unicode TestRunner dynamic link library (DLL) "Multithreaded DLL" testrunneru.lib: MFC Unicode TestRunner import library "Multithreaded DLL" testrunnerud.dll: MFC Unicode TestRunner dynamic link library (DLL ) "Debug Multithreaded DLL" Testrunnerud.lib: MFC Unicode Testrunner Import Library "Debug Multithreaded DLL" TESTRUNNERDSPLUGIN.DLL: Sign up to your VC addressed. Note: When you use CPPUnit DLL (CPPUnit * _dll.dll), you must connect the relevant import library and define the preprocessing ID CPPUnit_DLL in the Project. [Use CPPUnit] Writing unit test: In order to write unit tests, you need to connect CPPUnitxx.lib, which the XX here is the selected suffix letter. You must open the RTTI switch in your Project (Project Settings / C / C Language). The CPPUnit's include directory must be included in the Include lookup path. You can do this by adding the include directory in Project Settings / C / Preprocessor / Additional Include Director or Tools / Options / Directories / Include. Brief:

Open the RTTI switch connection lib / cppunitxx.lib include / must be included in the include lookup path: In order to use the GUI Test Runner, you need to connect Testrunnerxx.lib and CPPUnitxx.lib, the XX here, the selected configuration corresponds to the selected configuration The suffix letter. You must open the RTTI switch in your Project. File Testrunner.dll must be in the path where your application is located (Debug or Release Directory, the directory where the Project's DSP file is located, or the directory specified in the environment variable PATH). One of the simplest ways is to add a post-build command, or add Testrunner.dll in the lib / directory to your Project, and customize the creation step, copy the DLL file to your "intermediate results "Directory (usually a debug or release directory). Because Testrunner GUI is an Extended DLL of an MFC, it can access the CWINAPP of the current application. The parameter setting will use the application's registration key. This means that the setting item "Recently used test" is different for each application. Brief: Open the RTTI switch to connect lib / cppunitxx.lib and lib / Testrunnerxx.lib include / must be included in the include lookup path to run your project, lib / Testrunnerxx.dll must be available with DSPLUGIN: You must register in VC The plugin. Click Browse in Tools / Customize / Add-Ins and Macro Files and select LIB / TESTRUNNERDSPLUGIN.DLL (you can register the Release version or Debug version). If VC is running, when you double-click a Failure, VC will open the relevant file and locate it. Using Test Plug in Runner: Your DLL must export (export) a function that implements the interface defined in include / MSVC6 / TESTRUNNER / TESTPLUGININTERFACE.H. As an example, see Examples / MSVC6 / TestPlugin / TestPluginInterfaceImpl. *. Note: This runner is still in the experimental phase and has not been tested.

转载请注明原文地址:https://www.9cbs.com/read-97298.html

New Post(0)