cppunit

C++ Unit Testing Libraries [closed]

白昼怎懂夜的黑 提交于 2019-12-17 19:13:55
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I've come across cppunit but it didn't look super-easy to use (maybe I didn't look hard, maybe because C++ doesn't work like Java/C#). Are there widely used, simple alternatives? In fact, is cppunit the standard unit testing framework for C++? 回答1: There is no standard unit testing library for C++. There are many

Why this macro accepts a template with 1 parameter and refuses a template with 2 parameters?

流过昼夜 提交于 2019-12-12 04:12:34
问题 I'm working with CPPUNIT 1.12.1. It has those macro defined: #define CPPUNIT_TEST_SUITE_ADD_TEST( test ) \ context.addTest( test ) #define CPPUNIT_TEST( testMethod ) \ CPPUNIT_TEST_SUITE_ADD_TEST( \ ( new CPPUNIT_NS::TestCaller<TestFixtureType>( \ context.getTestNameFor( #testMethod), \ &TestFixtureType::testMethod, \ context.makeFixture() ) ) ) I want to add many tests to the same test suite using templates (as CPPUNIT works, every test must be a void function, so using template makes it

Xcode 4 can't find CPPUNIT

六月ゝ 毕业季﹏ 提交于 2019-12-11 10:20:51
问题 I installed Xcode 4 awhile ago and I finally got around to getting cppunit installed. I tried using it in one of my projects last night and I keep getting errors that Xcode cannot find cppunit files. E.g. Lexical or Preprocessor Issue 'cppunit/extensions/TestFactoryRegistry.h' not found. main.cpp #include <iostream> #include "exception.h" #include "dataStruct.h" #include <cppunit/extensions/TestFactoryRegistry.h> #include <cppunit/ui/text/TestRunner.h> int main () { CppUnit::TextUi:

Is there a cppunit equivalent to nunit's Category attribute for test cases?

孤人 提交于 2019-12-11 05:21:02
问题 I'd like an equivalent function to nUnit's Category attribute for test cases. I have inherited a large number of C++ test cases, some of which are unit tests and some of which are longer-running integration tests, and I need to set up my continuous integration build process to ignore the integration test cases. I would prefer to simply tag all the integration test cases and instruct cppunit to exclude them during CI builds. Am I overlooking a feature of cppunit or is there an alternative way

CppUnit: Run a single Test Case

时光总嘲笑我的痴心妄想 提交于 2019-12-10 11:46:18
问题 In http://cppunit.sourceforge.net/doc/lastest/cppunit_cookbook.html They give a simple TestCase but do not show how to run it (There is no main function). I've looked through their documentation and can't find how to just run a test and get text output about whether or not it succeeded. I don't want to put together a fixture or use a registry or anything. How do I run that single test case? I.E. What is the main function that would go along with that? 回答1: I gather you were asking for a SSCCE

没有找到MSVCP80D.dll,因此这个应用程序未能启动。重新安装应用程序...

你说的曾经没有我的故事 提交于 2019-12-09 18:11:18
在VS 2005中建立Win32工程时(以VS 2005中文版为例),你可能会遇到这样的运行错误:“没有找到MSVCP80D.dll,因此这个应用程序未能启动。重新安装应用程序可能会修复此问题。”(还可能是其它几个类似的文件:MSVCR80D.dll、MSVCM80D.dll)。对于VS2005新手,可能遇到的第一个问题便是此问题。 一直使用VC6进行开发测试,最近准备把平台转移到VS2005了。于是,决定先把CppUnit转移到此平台上来。在VS2005中编译CppUnit所遇到的问题不多,虽然没VC6方便。但是在测试编译好的CppUnit库时却遇到了困难:把以前在VC6中写的AES移植过来(其使用了CppUnit进行单元测试),在运行时却遇到了如上错误。刚开始以为可能是CppUnit没有编译好,重新编译CppUnit多次,调整编译参数,但始终有此错误,并且此错误有时出现有时不出现,这更晕了,大量时间就这样浪费了。等我静下来,才觉得可能是VS 2005的原因,于是上网搜索此错误信息,终于找到了问题所在。 VS 2005在生成可执行文件时使用了一种新的技术,该技术生成的可执行文件会伴随生成一个清单文件(manifest file)(.manifest后缀文件)(其本质上是XML文档,你可以用文本编辑器打开看看),并在链接完成后将该清单文件嵌入到exe文件中(默认情况下)

How to install CPPUnit for Visual C++ 2005?

此生再无相见时 提交于 2019-12-09 03:37:35
I want to start to do some unit testing however I am really confused about how to setup CPPUnit. I have looked at various tutorials and guides online to find out what to do but there are so many variants of what to do. I've tried a few ways but none seem to work. If anyone could pont me in the right direction of what to do then I woudl be extremeley grateful. I am currently using visual studio 2005 and most of my apps are mainly MFC I also create a fair amount of .net apps so ideally I want it to work for both. I am a massive newbie so when explaining please try and keep technical jargon down

Where do I place the Unit Testing source and expose the internal components?

人盡茶涼 提交于 2019-12-07 18:16:07
问题 I am taking over a project that exposes components via ATL. I see two major areas for the unit test to cover with this setup: Testing the internal components (may or may not be exposed via COM) Testing the external exposed components (aka testing the exposed interface) Currently the project has all of its internal components unit tests inside of the solution. They are enabled by a preprocessor flag that compiles it in and executes when you run. From the research I have been doing, it appears

CppUnit: Run a single Test Case

穿精又带淫゛_ 提交于 2019-12-06 19:19:30
In http://cppunit.sourceforge.net/doc/lastest/cppunit_cookbook.html They give a simple TestCase but do not show how to run it (There is no main function). I've looked through their documentation and can't find how to just run a test and get text output about whether or not it succeeded. I don't want to put together a fixture or use a registry or anything. How do I run that single test case? I.E. What is the main function that would go along with that? I gather you were asking for a SSCCE of CppUnit. As CppUnit is a framework, so a minimal example must put minimal test structure in place --

How to build CppUnit with Visual Studio 2010

╄→尐↘猪︶ㄣ 提交于 2019-12-05 23:02:47
问题 I am trying to build CppUnit (first line in ReadMe says version 1.13) with Visual Studio 2010. Following the instructions (found on web forums, couldn't find much in CppUnit documentation); I cannot find a valid file extension. All file extensions end with ",v" what is this weird ",v" extension and what is the purpose of it? I am frustrated at this point, if someone can help with how to load CppUnit in VS2010 project and build it....that would be a great help ! 回答1: Are you referring to this