如何为 Visual Studio C++ 设置单元测试

How to set up unit testing for Visual Studio C++(如何为 Visual Studio C++ 设置单元测试)
本文介绍了如何为 Visual Studio C++ 设置单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我无法弄清楚如何在 Visual Studio 2008 中为 C++ 设置和使用测试框架,大概是内置的单元测试套件.

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.

推荐答案

这个页面可能会有所帮助,它回顾了很多 C++ 单元测试框架:

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

  • CppUnit
  • Boost.Test
  • CppUnitLite
  • NanoCppUnit
  • 单元++
  • CxxTest

查看CPPUnitLiteCPPUnitLite2.

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

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 试图制作一个真正的 C++ 风格的测试框架,而不是一个移植到 C++ 的 Java.(我是从 Feather 的 有效地使用旧代码书).CPPUnitLite2 似乎是另一种重写,具有更多功能和错误修复.

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.

我还偶然发现了 UnitTest++ 其中包括来自 CPPUnitLite2 和其他一些框架的内容.

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

Microsoft 已发布 WinUnit.

Microsoft has released WinUnit.

也结帐CatchDoctest

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

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Bring window to front -gt; raise(),show(),activateWindow() don’t work(把窗户放在前面 -raise(),show(),activateWindow() 不起作用)
How to get a list video capture devices NAMES (web cameras) using Qt (crossplatform)? (C++)(如何使用 Qt(跨平台)获取列表视频捕获设备名称(网络摄像机)?(C++))
How to compile Qt as static(如何将 Qt 编译为静态)
C++ over Qt : Controlling transparency of Labels and Buttons(C++ over Qt:控制标签和按钮的透明度)
How to know when a new USB storage device is connected in Qt?(Qt如何知道新的USB存储设备何时连接?)
What is an event loop in Qt?(Qt 中的事件循环是什么?)