博客
关于我
单元测试----CppUnit
阅读量:163 次
发布时间:2019-02-27

本文共 799 字,大约阅读时间需要 2 分钟。

下载CppUnit

从这里下载 ,解压如下:

  • src:源代码
  • lib:编译好的库
  • include:头文件
  • examples:例子
  • doc:说明文档
  • contrib:他人贡献的外围代码
  • config:配置文件

 


编译

在src/目录下, 将CppUnitLibraries.dsw工程文件用vc 打开。执行build/batch build,编译通过以后, 在lib/目录下,会生成若干lib,和dll文件, 都以cppunit开头. cppunitd表示debug版, cppunit表示release版(中途或者会有些project编译失败,一般不用管它)。其中项目cppunit为静态库,cppunit_dll为动态库,生成的库文件为:

  • cppunit.lib:静态库release版;
  • cppunitd.lib:静态库debug版;
  • cppunit_dll.lib:动态库release版;
  • cppunitd_dll.lib:动态库debug版;

另外一个需要关注的project是TestRunner,它输出一个dll,提供了一个基于GUI 方式的测试环境,在CppUnit下, 可以选择控制台方式和GUI方式两种表现方案。两种方案分别如下图所示:

控制台方式:

GUI方式:

 


设置

 

要使用CppUnit,还得设置好头文件和库文件路径,选择Tools/Options/Directories,在Include files和Library files中分别添加%CppUnitPath%include和%CppUnitPath%lib,其中%CppUnitPath%表示CppUnit所在路径。

TestRunner.dll为我们提供了基于GUI的测试环境。为了让我们的测试程序能正确的调用它,最简单的方法是在操作系统的环境变量Path中添TestRunner.dll的路径。


使用

具体请看:

              

你可能感兴趣的文章
No static resource favicon.ico.
查看>>
no such file or directory AndroidManifest.xml
查看>>
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
查看>>
NO.23 ZenTaoPHP目录结构
查看>>
no1
查看>>
NO32 网络层次及OSI7层模型--TCP三次握手四次断开--子网划分
查看>>
NOAA(美国海洋和大气管理局)气象数据获取与POI点数据获取
查看>>
NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
查看>>
node
查看>>
node exporter完整版
查看>>
node HelloWorld入门篇
查看>>
Node JS: < 一> 初识Node JS
查看>>
Node JS: < 二> Node JS例子解析
查看>>
Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime(93)解决
查看>>
Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime(72)
查看>>
Node 裁切图片的方法
查看>>
node+express+mysql 实现登陆注册
查看>>
Node+Express连接mysql实现增删改查
查看>>
node, nvm, npm,pnpm,以前简单的前端环境为什么越来越复杂
查看>>
Node-RED中Button按钮组件和TextInput文字输入组件的使用
查看>>