We need to migrate a unit test harness developed with C# and NUnit to C++ running on Red Hat Linux.
我们需要将使用C#和NUnit开发的单元测试工具迁移到在Red Hat Linux上运行的C ++。
We want to minimize the efforts in migration.
我们希望尽量减少迁移工作。
We are reading resources such as this:
我们正在阅读这样的资源:
http://gamesfromwithin.com/exploring-the-c-unit-testing-framework-jungle
But we don't see anything similar to NUnit.
但我们没有看到任何类似于NUnit的东西。
10 个解决方案
#1
4
Expanding on Mark Bessey's answer: I really like cxxTest because it's just a set of C++ header files & Perl scripts. As long as you have a C++ compiler & Perl, it will work on nearly any system. It also has features to integrate with your IDE (although I haven't used them).
扩展Mark Bessey的答案:我真的很喜欢cxxTest,因为它只是一组C ++头文件和Perl脚本。只要你有一个C ++编译器和Perl,它几乎适用于任何系统。它还具有与IDE集成的功能(虽然我没有使用它们)。
Also, here's a good article Exploring the C++ Unit Testing Framework Jungle. This post is potentially out of date (circa 2004), but gives a great summary of features & straight-up examples utilizing each of the following C++ unit testing frameworks:
另外,这是一篇很好的文章探索C ++单元测试框架丛林。这篇文章可能已经过时了(大约2004年),但是对使用以下每个C ++单元测试框架的功能和直接示例进行了很好的总结:
- CppUnit
- Boost.Test
- CppUnitLite
- NanoCppUnit
- Unit++
- CxxTest
#2
9
Have You considered using CppUnit?
你考虑过使用CppUnit吗?
Here is an overview on unit testing frameworks for C++.
以下是C ++单元测试框架的概述。
#3
7
We use Google Mock and Google Test. Having never used NUnit, though, I can't comment on how similar it is to NUnit.
我们使用Google Mock和Google Test。但是,从未使用过NUnit,我无法评论它与NUnit的相似程度。
#5
4
You won't find anything very much like NUnit, unfortunately. Since C++ doesn't have the same strong reflection ability, the process for defining tests needs to be somewhat more explicit, rather than using attributes, as in NUnit.
不幸的是,你找不到像NUnit那样的东西。由于C ++没有相同的强反射能力,因此定义测试的过程需要更加明确,而不是像在NUnit中那样使用属性。
I like cxxtest because it's easy to set up, and doesn't require manual test registration.
我喜欢cxxtest,因为它易于设置,不需要手动测试注册。
#6
3
I recommend you try UnitTest++:
http://unittest-cpp.sourceforge.net/UnitTest++.html
我建议你尝试使用UnitTest ++:http://unittest-cpp.sourceforge.net/UnitTest++.html
I don't know if it is similar to NUnit, but it is powerful, elegant, and simple-to-use.
我不知道它是否与NUnit类似,但它功能强大,优雅且易于使用。
#7
3
I use Boost.Test. I used to use CppUnit, but found that it works in a Java/Junit way as opposed to a C++ way. For example using setup and teardown methods instead of constructors and desctructors. Also the Test Case / Fixture support was a little laborious since C++ doesn't support reflection.
我使用Boost.Test。我曾经使用CppUnit,但发现它以Java / Junit方式工作,而不是C ++方式。例如,使用setup和teardown方法而不是构造函数和析构函数。此外,测试用例/夹具支持有点费力,因为C ++不支持反射。
I found Boost.Test fitted better with the C++ code I was testing. It is also a lot more powerful. After a while I ported all my CppUnit tests to Boost.Test, this took about a day and I haven't looked back.
我发现Boost.Test更适合我正在测试的C ++代码。它也更强大。过了一会儿,我将所有的CppUnit测试移植到Boost.Test,这花了大约一天时间,我没有回头。
As far as I know the person behind cppunit also wrote cxxunit which is more C++esque.
据我所知,cppunit背后的人也写了cxxunit,这是更多的C ++ esque。
#8
2
Googletest is very similar in usage to xUnit. Googlemock is by far th best mocking framework for C++. The libraries are cross platform, have excellent documentation and an active user base. All you need is a compliant C++ compiler that can handle templates.
Googletest与xUnit的使用非常相似。 Googlemock是迄今为止最好的C ++模拟框架。这些库是跨平台的,具有出色的文档和活跃的用户群。您只需要一个可以处理模板的兼容C ++编译器。
Michael Feathers, the original author of CppUnit, now recommends CppUnitLite, which is a bare bones framework. Once I have regaled him with the joys of Googlemock at ACCU 2010 I hope he'll embrace it :-)
CppUnit的原作者Michael Feathers现在推荐CppUnitLite,这是一个简单的骨架。一旦我在ACCU 2010上用Googlemock的乐趣给他打电话,我希望他能接受它:-)
#9
2
There is a relatively new kid on the block called WinUnit. I haven't had time to try it myself but it might be worth a look.
名为WinUnit的块上有一个相对较新的孩子。我没有时间亲自尝试,但值得一看。
#10
1
There is a good one called CPPUnit. It started its life as a port of JUnit to C++ by Michael Feathers. I have worked with it and it is great. Note though, that unit testing in C++ is harder than in other languages.
有一个很好的名为CPPUnit。它起源于Michael Feathers作为JUnit to C ++的端口。我已经使用它,它很棒。但请注意,C ++中的单元测试比其他语言更难。
#1
4
Expanding on Mark Bessey's answer: I really like cxxTest because it's just a set of C++ header files & Perl scripts. As long as you have a C++ compiler & Perl, it will work on nearly any system. It also has features to integrate with your IDE (although I haven't used them).
扩展Mark Bessey的答案:我真的很喜欢cxxTest,因为它只是一组C ++头文件和Perl脚本。只要你有一个C ++编译器和Perl,它几乎适用于任何系统。它还具有与IDE集成的功能(虽然我没有使用它们)。
Also, here's a good article Exploring the C++ Unit Testing Framework Jungle. This post is potentially out of date (circa 2004), but gives a great summary of features & straight-up examples utilizing each of the following C++ unit testing frameworks:
另外,这是一篇很好的文章探索C ++单元测试框架丛林。这篇文章可能已经过时了(大约2004年),但是对使用以下每个C ++单元测试框架的功能和直接示例进行了很好的总结:
- CppUnit
- Boost.Test
- CppUnitLite
- NanoCppUnit
- Unit++
- CxxTest
#2
9
Have You considered using CppUnit?
你考虑过使用CppUnit吗?
Here is an overview on unit testing frameworks for C++.
以下是C ++单元测试框架的概述。
#3
7
We use Google Mock and Google Test. Having never used NUnit, though, I can't comment on how similar it is to NUnit.
我们使用Google Mock和Google Test。但是,从未使用过NUnit,我无法评论它与NUnit的相似程度。
#4
#5
4
You won't find anything very much like NUnit, unfortunately. Since C++ doesn't have the same strong reflection ability, the process for defining tests needs to be somewhat more explicit, rather than using attributes, as in NUnit.
不幸的是,你找不到像NUnit那样的东西。由于C ++没有相同的强反射能力,因此定义测试的过程需要更加明确,而不是像在NUnit中那样使用属性。
I like cxxtest because it's easy to set up, and doesn't require manual test registration.
我喜欢cxxtest,因为它易于设置,不需要手动测试注册。
#6
3
I recommend you try UnitTest++:
http://unittest-cpp.sourceforge.net/UnitTest++.html
我建议你尝试使用UnitTest ++:http://unittest-cpp.sourceforge.net/UnitTest++.html
I don't know if it is similar to NUnit, but it is powerful, elegant, and simple-to-use.
我不知道它是否与NUnit类似,但它功能强大,优雅且易于使用。
#7
3
I use Boost.Test. I used to use CppUnit, but found that it works in a Java/Junit way as opposed to a C++ way. For example using setup and teardown methods instead of constructors and desctructors. Also the Test Case / Fixture support was a little laborious since C++ doesn't support reflection.
我使用Boost.Test。我曾经使用CppUnit,但发现它以Java / Junit方式工作,而不是C ++方式。例如,使用setup和teardown方法而不是构造函数和析构函数。此外,测试用例/夹具支持有点费力,因为C ++不支持反射。
I found Boost.Test fitted better with the C++ code I was testing. It is also a lot more powerful. After a while I ported all my CppUnit tests to Boost.Test, this took about a day and I haven't looked back.
我发现Boost.Test更适合我正在测试的C ++代码。它也更强大。过了一会儿,我将所有的CppUnit测试移植到Boost.Test,这花了大约一天时间,我没有回头。
As far as I know the person behind cppunit also wrote cxxunit which is more C++esque.
据我所知,cppunit背后的人也写了cxxunit,这是更多的C ++ esque。
#8
2
Googletest is very similar in usage to xUnit. Googlemock is by far th best mocking framework for C++. The libraries are cross platform, have excellent documentation and an active user base. All you need is a compliant C++ compiler that can handle templates.
Googletest与xUnit的使用非常相似。 Googlemock是迄今为止最好的C ++模拟框架。这些库是跨平台的,具有出色的文档和活跃的用户群。您只需要一个可以处理模板的兼容C ++编译器。
Michael Feathers, the original author of CppUnit, now recommends CppUnitLite, which is a bare bones framework. Once I have regaled him with the joys of Googlemock at ACCU 2010 I hope he'll embrace it :-)
CppUnit的原作者Michael Feathers现在推荐CppUnitLite,这是一个简单的骨架。一旦我在ACCU 2010上用Googlemock的乐趣给他打电话,我希望他能接受它:-)
#9
2
There is a relatively new kid on the block called WinUnit. I haven't had time to try it myself but it might be worth a look.
名为WinUnit的块上有一个相对较新的孩子。我没有时间亲自尝试,但值得一看。
#10
1
There is a good one called CPPUnit. It started its life as a port of JUnit to C++ by Michael Feathers. I have worked with it and it is great. Note though, that unit testing in C++ is harder than in other languages.
有一个很好的名为CPPUnit。它起源于Michael Feathers作为JUnit to C ++的端口。我已经使用它,它很棒。但请注意,C ++中的单元测试比其他语言更难。