如何运行 CPPUnit 单元测试
我使用 CPPUnit 编写了一些 C++ 单元测试。
但我不明白如何运行它们。
有没有类似 Nunit-gui 的工具?
目前我已经在 DLL 中编写并打包了测试。
当我谷歌时,我发现了这个 http://cppunit.sourceforge.net/doc/lastest/ cppunit_cookbook.html
但我无法理解它如何从 DLL 获取测试。
I have written few c++ Unit tests using CPPUnit.
But I do not understand how to run those.
Is there any tool like Nunit-gui?
Currently I have written and packed tests in a DLL.
When i google i found this http://cppunit.sourceforge.net/doc/lastest/cppunit_cookbook.html
But I am not able to understand how it gets tests from a DLL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将您的测试用例分组到 TestSuite 中,编写 main()、编译、链接到 cppunit 库并从命令行运行可执行文件。
这是一个主要功能的示例:
如果您确实想要一个 GUI,可以使用 QxRunner。
Group your TestCases into TestSuite, write a main(), compile, link against the cppunit library and run the executable from the command-line.
Here is an example of a main function.:
If you really want a GUI, there is QxRunner.
如果您在 Windows 上并且正在测试 C++,我建议人们在 Visual Studio 中使用 cppunit。 如何在 Visual Studio 中配置 cppunit 以及如何通过示例使用它? 如果您已经下载了 cppunit 文件。 然后在你的视觉工作室项目中你需要设置一些东西
1)。 在 Visual Studio 项目位置的 cppunit 文件中给出包含文件夹的路径,项目属性 > C/C++> 一般> 其他包含目录。
2). 在 Visual Studio 项目位置的 cppunit 文件中给出 lib 文件夹的路径,项目属性 > 链接器> 一般> 其他库目录。
3). 在 Visual Studio 项目的位置添加文件“cppunit.lib”,项目属性> 链接器> 输入> 其他依赖项。
按照下面的链接中的分步过程进行操作
http://www.areobots.com/unit-testing-with-cppunit-visual-studio-configuration/
http://www.areobots.com/how-to-do-unit-testing-with-cppunit-with-example/< /a>
I would suggest people to use cppunit in visual studio if you are on windows and if you are testing for C++. How to configure cppunit in visual studio and how to use it with example? if you have downloaded the cppunit file. Then in your visual studio project you need to set few things
1). Give the path of include folder inside your cppunit file at location of your visual studio project, Project properties > C/C++ > General > Additional include directories.
2). Give the path of lib folder inside your cppunit file at location of your visual studio project, Project properties > Linker > General > Additional library directories.
3). Add a file "cppunit.lib" at location of your visual studio project, Project properties > Linker > Input > Additional Dependencies.
Follow the step by step procedure in the link below
http://www.areobots.com/unit-testing-with-cppunit-visual-studio-configuration/
http://www.areobots.com/how-to-do-unit-testing-with-cppunit-with-example/
正如以下链接中提到的
http://cvs.forge.objectweb.org/cgi-bin/viewcvs .cgi/checkout/sync4j/tools/cppunit/INSTALL-WIN32.txt?rev=1.1.1.1
TestPlugInRunner即可使用
As mentioned in following link
http://cvs.forge.objectweb.org/cgi-bin/viewcvs.cgi/checkout/sync4j/tools/cppunit/INSTALL-WIN32.txt?rev=1.1.1.1
TestPlugInRunner can be used