如何在visual studio 2012的c ++中创建单元测试 [英] How to create a Unit Testing in c++ for visual studio 2012

查看:71
本文介绍了如何在visual studio 2012的c ++中创建单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为我提供示例程序和逐步过程,以便在c ++中为visual studio 2012进行单元测试

Give me the sample program and step by step process for unit testing in c++ for visual studio 2012

推荐答案

不幸的是,与C#不同,没有内置功能一般来说,支持C ++的单元测试(没有反射),因此没有最佳方法可以解决这个问题。相反,它在很大程度上取决于你想要实现什么,使用什么工具,在哪个平台上。



使用关键词C ++ unit检查你选择的搜索引擎测试。如果您的意思是VisualStudio本机C ++(或任何非VS C ++ IDE),请确保添加native;如果您打算使用VisualStudio托管的C ++ / CLI,请确保托管 - 两者之间存在天壤之别! />


检查结果,看看哪些适用于您的要求(哪个没有提及)。有一些工具可以帮助您设置单元测试,有些甚至提供更适合除此论坛之外的任何其他问题的开发人员论坛! cppunit 是我从头脑中回忆的一个这样的工具 - 你可以搜索更多信息。
Unfortunately, unlike C#, there is no built-in support for unit tests for C++ in general (no reflection), so there is no optimal way to go about this. Instead it very much depends on what you want to achieve, with what tools, on which platform.

Check a search engine of your choice with the key words "C++ unit test". Make sure to add "native" if you meant VisualStudio native C++ (or any non-VS C++ IDE), or "managed" if you intended to use VisualStudio managed C++/CLI instead - there's a world of difference between the two!

Check the results and see what does and doesn't apply to your requirements (which btw. you failed to mention). There are tools around that help you set up unit tests, and some even provide developer forums that are more suitable for any further questions than this forum! cppunit is one such tool I recall from the top of my head - you can search for more info on this.


这篇关于如何在visual studio 2012的c ++中创建单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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