Introduction
C ++ Test is an automated testing tool for C/C ++ by Parasoft. It can automatically Test code construction (white-box testing) and Test code functionality (black box testing) and maintain code integrity (regression testing ).
For the introduction of C ++ test, please refer to the http://baike.baidu.com/view/1802672.htm
Or refer to the introduction of http://www.parasoft.com.
C ++ test has two types: Eclipse and IDE, respectively for different development projects.
Project types that can be tested in Eclipse:
For projects above VS6.0. sln, use the corresponding VS2003/VS2005/VS2008 plug-in version for testing.
Command Line Test
The general process of testing from the command line is as follows:
• Use a valid cpptestcli program and add appropriate options to start analysis in command line mode. The complete list of options is provided in cli options. Key options include:
•-Data: Specifies the location of the Eclipse workspace.
•-Config: Specify the test configuration.
•-Resource: Specifies the project/file to be tested.
•-Publish: publish the test results to the team server.
•-Report: generate a report.
•-Localsettings: deliver advanced settings for Team Server/Report Center/email Report (Team Server/Parasoft Report Center/mail reporting. The options are described in the local settings (options) file.
Note:
During testing, the workspace cannot be occupied. For example, an error is reported when you open the GUI.
When importing a project, if the existing project in the workspace has the same name as the imported project, the new project will not be imported.
1. Visual Studio 6.0 Project
Run cpptestcli in eclipse C ++ Test
Cpptestcli
-Data "C: \ Documents ents and Settings \ Administrator \ Parasoft \ cpptest \ workspace"
-Dsp "D: \ My Virtual Machines \ SharedFiles \ BugDetectiveTest1 \ BugDetectiveTest1.dsp"
-Resource "BugDetectiveTest1"
-Config "builtin: // Crules"
-Report "C: \ report"
Note:
-Data: Specify the working directory workspace.
-Dsp: Specifies the project to be imported, corresponding to the project file. dsw of VC6, or project file. dsp
-Resource: Specifies the object to be tested. It can be a file, project, or project. It can be reused to specify multiple test objects.
-Config: Specifies the rule to be used.
-Report: Specifies the report output path or output file name.
2. VS2003/VS2005/VS2008 Project
Run cpptestcli in C ++ Test IDE such as C ++ Test for visual studio 2008.
Cd C: \ Program Files \ Parasoft \ C ++ test7.2VS2008Extension
Cpptestcli.exe
-Solution "C: \ cpptest \ Source \ DebugTestVS9 \ DebugTestVS9.sln"
-Resource "DebugTestVS9"
-Config "user: // BD"
Note:
-Solution: Specifies the project to be imported. sln
-Resource: Specifies the object to be tested. It can be a file, project, or project. It can be reused to specify multiple test objects.
-Config: Specifies the rule to be used.
-Report: Specifies the report output path or output file name.
3. Import Makefile
First, construct the data file. bdf through cpptestscan.
Two methods are available,
1.
C: \ Documents ents and Settings \ Administrator \ Parasoft \ cpptest \ SRC \ maketest>
Nmake/f main. mak CPP = "cpptestscan.exe -- cpptestscanOutputFile = C: \ MyProject. bdf -- cpptestscanProjectName = MyProject cl.exe"
2. Replace the compiler option in makefile (error-prone)
"CXX = g ++"
Replace
"Ifeq ($ (BUILD_MODE), PARASOFT_CPPTEST)
CXX = 'C: \ Program Files \ Parasoft \ C ++ test7.1 \ cpptestscan.exe '-- cpptestscanOutputFile =./cpptestscan. bdf -- cpptestscanProjectName = MyProject g ++
Else
CXX = g ++
Endif"
Then, run the build process as before and specify the new BUILD_MODE variable for make:
Make BUILD_MODE = PARASOFT_CPPTEST
The build code and generate a build data file (MyProject. bdf ). The generated build data file can be used from the GUI or from the command line to create a project.
After generating bdf, use C ++ test to import the project and perform the test.
C: \ Documents ents and Settings \ Administrator \ Parasoft \ cpptest \ SRC \ maketest>
Cpptestcli
-Data "C: \ Documents ents and Settings \ Administrator \ Parasoft \ cpptest \ workspace"
-Bdf "C: \ MyProject. bdf"
-Localsettings opts. properties
-Resource "MyProject \ maketest"
-Config "builtin: // BugDetective (License Required )"
-Report "C: \ report"
-Localsettings opts. properties: Specifies the project build configuration.
Bdf. import. compiler. family = <family>
Specify this option to select the compiler.
Opts. properties content
Bdf. import. compiler. family = vc_6_0
Specify the compiler as vc6.
* Generate a report in the specified format
Add the following content to the localsetting properties file:
Report. format = custom
Report. custom. extension = csv
Report. custom. xsl. file = c:/csvreport. xsl