如何为Visual Studio C ++设置单元测试 [英] How to set up unit testing for Visual Studio C++

查看:160
本文介绍了如何为Visual Studio C ++设置单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法弄清楚如何在Visual Studio 2008 for C ++中建立和使用测试框架,可能是内置的单元测试套件。



解决方案

这个页面可以帮助,它审查了几个C ++单元测试框架:






  • Boost.Test

  • CppUnitLite

  • NanoCppUnit

  • 单位++

  • CxxTest



查看 CPPUnitLite CPPUnitLite2



CPPUnitLite 由Michael Feathers创建,他最初将Java的JUnit移植到C ++作为CPPUnit(CPPUnit尝试模仿JUnit的开发模型 - 缺少Java的功能[例如反射],使其易于使用)。



CPPUnitLite尝试创建一个真正的C ++风格的测试框架,而不是一个移植到C ++的Java。 (我改写自Feather的有效使用旧版代码图书)。



我也遇到了 =http://sourceforge.net/projects/unittest-cpp/> UnitTest ++ ,其中包含来自CPPUnitLite2和其他框架的内容。



Microsoft已发布 WinUnit (通过MSDN杂志)。该代码的下载链接似乎已损坏,但这里是一个 link in the comments 此处



*更新: WinUnit首页 * / p>

I'm having trouble figuring out how to get the testing framework set up and usable in Visual Studio 2008 for C++ presumably with the built-in unit testing suite.

Any links or tutorials would be appreciated.

解决方案

This page may help, it reviews quite a few C++ unit test frameworks:

  • CppUnit
  • Boost.Test
  • CppUnitLite
  • NanoCppUnit
  • Unit++
  • CxxTest

Check out CPPUnitLite or CPPUnitLite2.

CPPUnitLite was created by Michael Feathers, who originally ported Java's JUnit to C++ as CPPUnit (CPPUnit tries mimic the development model of JUnit - but C++ lacks Java's features [e.g. reflection] to make it easy to use).

CPPUnitLite attempts to make a true C++-style testing framework, not a Java one ported to C++. (I'm paraphrasing from Feather's Working Effectively with Legacy Code book). CPPUnitLite2 seems to be another rewrite, with more features and bug fixes.

I also just stumbled across UnitTest++ which includes stuff from CPPUnitLite2 and some other framework.

Microsoft has released WinUnit (via MSDN magazine). The download link for the code seems broken, but here is a link found in the comments here.

* Update: WinUnit Homepage *

这篇关于如何为Visual Studio C ++设置单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆