0

Which is a better Unit Testing framework to use for C/C++?

  1. UnitTest++ or
  2. Google Test

I am new to both. Unittest has less documentation, Google test has a lot of documentation

razlebe
  • 7,134
  • 6
  • 42
  • 57
  • "Better" is not easy to define. Since you mention documentation, is that what you think makes a product "better"? If so, you have your answer. If you think something else makes a product "better", please include your definition of "better". – S.Lott Apr 08 '11 at 11:09
  • 1
    Why don't you try both and pick the one you are most comfortable with? – jfs Apr 08 '11 at 11:15
  • 1
    Look at http://stackoverflow.com/questions/1067236/c-c-testing-framework-like-junit-for-java/ – Johann Gerell Apr 08 '11 at 11:37
  • possible duplicate of [C/C++ Testing framework](http://stackoverflow.com/questions/5578730/c-c-testing-framework) – philant Apr 09 '11 at 15:08
  • Can't comment on either really but you might find [this link](http://alexott.net/en/cpp/CppTestingIntro.html) useful. – Component 10 Apr 08 '11 at 11:09
  • For UnitTest++ go to github.com/unittest-cpp/unittest-cpp. Everything else is out of date. – Markus Sep 17 '13 at 11:34

3 Answers3

3

I'd been using Boost.Test for a couple of years, which was sort of ok, and comparable to both of your options.

Then I ran across Catch, and I haven't looked back since. It's just so much more convenient to use, I don't see any reason to go back to another framework.

It's located on GitHub here, and the developer is on SO as well.

Give it a shot. It's more concise and intuitive to use, it's header-only so it's a breeze to set up and use, and the developer is pretty responsive if you need a new feature or find a bug.

Community
  • 1
  • 1
jalf
  • 243,077
  • 51
  • 345
  • 550
2

From comparing the documentation, Google Test has a lot more features than UnitTest++ and is no harder to use.

I use Google Test and am very happy with it.

Josh Kelley
  • 56,064
  • 19
  • 146
  • 246
0

I've tried GoogleTest and cpptest.

Google test worked well and was easy to use. The drawback for me was the templates used in GoogleTest broke the code parsing in the IDE. None of the code completion features worked.

CppTest is almost as easy as GoogleTest and has the advantage that it implements a test suite class that you can extend using standard C++ derivation. I ended up choosing cpptest.

Jay
  • 13,803
  • 4
  • 42
  • 69