自动化工具cppunit在bcb中的应用方法

来源:互联网 发布:淘宝网复古文艺花盆 编辑:程序博客网 时间:2024/04/27 18:55

首先编译culib,然后build  TestRunnerProject,生成相应的了dlllib。注意:编译,会出现了4个warning,通过设置options/编译中的预编译hearder为none,即可正确。

../bcb/borland/TestRunner,将TestRunnerProject.dll拷贝到../bcb/borland/HostApp目录下

         给工程HostApp添加两个libTestRunnerProject.libculib.lib(通过View/Project manager,在工程下,点击右键,选择add进行添加)

 

New一个unit,Unit2.cpp),参考example添加cpp和头文件内容。Unit2.cpp)中和Unit2.h)的添加方法,可以参考自带的example。把Unit2.cpp)给工程HostApp添加add进来。

           

          HostAppUnitForm.Cpp文件中,添加include文件,如#include Unit2.h。并且添加如下代码:

           void __fastcall THostAppForm::startTesting()

          {runner.addTest( xxx::suite() );}其中,xxxTestsuite的名称。与Unit2.cpp)中定义的一致。

 

 

CppUnit15ProjectGroup.bpg工程中,去掉两个测试demo MulticasterExampleTestCase的方法如下:

         1.去掉在HostApp的工程里的Drectory/Conditionalslibrayinclude路径中的../../samples../../samples/multicaster

         2.Project Manager中的HostApp工程中删除ExampleTestCase.cppMulticastertest.cppMulticaster.cpp

         3.HostAppUnitForm.cpp去掉#include "ExampleTestCase.h"

         #include "MulticasterTest.h"

         4.HostAppUnitForm.cppstartTesting删除

         runner.addTest( MulticasterTest::suite() );

         runner.addTest( ExampleTestCase::suite() );

         然后就可以了 。

 

 

原创粉丝点击