How to set up unit testing for 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
查看CPPUnitLite 或 CPPUnitLite2.
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.
也结帐Catch 或 Doctest
这篇关于如何为 Visual Studio C++ 设置单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何为 Visual Studio C++ 设置单元测试


基础教程推荐
- 运算符重载的基本规则和习语是什么? 2022-10-31
- 调用std::Package_TASK::Get_Future()时可能出现争用情况 2022-12-17
- C++,'if' 表达式中的变量声明 2021-01-01
- 如何定义双括号/双迭代器运算符,类似于向量的向量? 2022-01-01
- 设计字符串本地化的最佳方法 2022-01-01
- 如何在 C++ 中处理或避免堆栈溢出 2022-01-01
- 您如何将 CreateThread 用于属于类成员的函数? 2021-01-01
- C++ 标准:取消引用 NULL 指针以获取引用? 2021-01-01
- 什么是T&&(双与号)在 C++11 中是什么意思? 2022-11-04
- C++ 程序在执行 std::string 分配时总是崩溃 2022-01-01