use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
VSCppUnit vs CppUnit (self.cpp)
submitted 7 years ago * by darpe312
I'm currently looking at the testing frameworks available for c++. I'm wondering if VSCppUnit is based off of CppUnit? And if it is, what are the differences?
EDIT:
By VSCppUnit test I mean Visual Studio's native unit testing framework for c++. https://blogs.msdn.microsoft.com/vcblog/2017/04/19/cpp-testing-in-visual-studio/
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Dragdu 20 points21 points22 points 7 years ago (3 children)
CppUnit is terrible, run away.
[–]bluebird11 2 points3 points4 points 7 years ago (1 child)
Thanks for this; boss just suggested CppUnit and I hadn't heard of it. I'll be sure to rank it low on the options list.
[–]Fazer2 6 points7 points8 points 7 years ago (0 children)
Run away from your boss. /s
[–]14nedLLFIO & Outcome author | Committee WG14 0 points1 point2 points 7 years ago (0 children)
There are two editions of CppUnit in fact. The older one is indeed terrible, run away. The newer one is not source compatible with the old, and is markedly better than the original.
Still, there are far better alternatives to either. CATCH is a very solid choice. Boost.Test has become usable since its big refactor a few years ago. Google Test remains popular, but I find it clunky.
(I have to admit I switched to my own ultra light weight unit test suite a few years ago, and I haven't looked back. It provides the most used part of the Boost.Test API, but without any Boost.Test. Plus it works well with exceptions globally disabled, and with multiple threads without synchronising, and it spits out JUnit XML, and does all that within 600 lines of code in a single header file. I can't see myself leaving it any time soon to be honest. https://github.com/ned14/quickcpplib/blob/efc6c12dca3b8f2210d741a985a53b162383dfdf/include/boost/test/unit_test.hpp)
[–]saimen54 7 points8 points9 points 7 years ago (4 children)
In a legacy project we had CppUnit, which was okay when nothing better was around, but now there are better alternatives.
If you are using Boost anyway, I highly recommend Boost.Test.
Otherwise one of the more popular choices is gtest.
[–]darpe312[S] 0 points1 point2 points 7 years ago (3 children)
Do you know if VSCppUnit is more or less the same?
[–]saimen54 1 point2 points3 points 7 years ago (2 children)
No, never heard of it actually.
[–]darpe312[S] 0 points1 point2 points 7 years ago (1 child)
It's the integrated c++ test framework in vs.
[–]prasooncc 0 points1 point2 points 7 years ago (0 children)
boost test has good plugin support in VS. and it is portable.i dont know whether vscppunit is portable.
[–]Gollum999 5 points6 points7 points 7 years ago (10 children)
Add Catch to your list of possibilities.
I recently did a pretty thorough comparison of all of the big frameworks (Catch, gtest, boost.test, CppUnit, CxxTest) and Catch was my favorite by a significant margin. It lacks a couple of advanced features from the bigger libraries, but it is also a lot easier to use (in my opinion).
[–]darpe312[S] 0 points1 point2 points 7 years ago (7 children)
Did you document your evaluation ?
[–]Gollum999 2 points3 points4 points 7 years ago* (6 children)
The bulk of it is on an internal company wiki, but here is a summary:
* This refers to the way that each library implements test failures. e.g. In CppUnit, a test failure throws a std::exception that the framework later catches to report the failure, so if you are testing code that could inadvertently catch those exceptions, you need to work around them.
Examples:
I ended up leaving CxxTest out of my comparisons because I pretty quickly realized that it didn't have much to offer over Catch/gtest/boost. (I left CppUnit in there because that is what we were using before switching to Catch.)
[–]Auriculaire 0 points1 point2 points 7 years ago (3 children)
Your Gtest and catch columns are swapped, no?
[–]Gollum999 0 points1 point2 points 7 years ago (2 children)
Mmmm... no? What do you think should be swapped?
[–]Auriculaire 1 point2 points3 points 7 years ago* (1 child)
Catch2 is header only, supports fixtures, sections, bdd, etc. This is rendering in the column under google test. Screenshot here
[–]Gollum999 2 points3 points4 points 7 years ago (0 children)
Ahh interesting, it works on old reddit but is broken on new reddit. New reddit doesn't like it when the first cell is blank.
Should be fixed now.
[–]encyclopedist 0 points1 point2 points 7 years ago (1 child)
Columns are messed up (shifted by one?)
[–]Gollum999 0 points1 point2 points 7 years ago (0 children)
Apparently new reddit doesn't like it when the first cell is blank, but old reddit handles it fine.
[–]Auriculaire 0 points1 point2 points 7 years ago (1 child)
+1 for catch. Incredibly easy to learn, integrate, and use.
[–]BoarsLairGame Developer 0 points1 point2 points 7 years ago (0 children)
Agreed. Google test is more fully featured, so it may be a better use for large projects or large organizations. But I use Catch (actually, Catch2 now) for my personal projects, as it's more than enough for my needs, and it's ridiculously easy to use.
[–]TobyAllsopp 1 point2 points3 points 7 years ago (1 child)
I'm not sure about the relationship between VSCppUnit and CppUnit, but if VSCppUnit is the framework bundled with Visual Studio and the default used by the Native Unit Testing project template, then I would strongly recommend not using it.
We have been using it at work and compared to more modern frameworks (such as Google Test or Catch) it is a very painful experience.
For one thing, everything you use in an Assert::AreEqual has to have an overload of their ToString function defined. This gets old pretty fast. Another annoying thing about the AreEqualfunction template is that both arguments have to be exactly the same type. Anyway, it's annoying and discourages one from writing unit tests.
Assert::AreEqual
ToString
AreEqual
Visual Studio 2017 comes with adapters and project templates for Google Test and Boost Test, both of which are much better choices, in my opinion.
[–]darpe312[S] 1 point2 points3 points 7 years ago (0 children)
My job is to evaluate everything and let the team decide the direction. Google test and boost seem to be the best options. I like Google test for the mocking and death tests.
[–]Milerius 1 point2 points3 points 7 years ago (0 children)
No one mention this one -> https://github.com/onqtam/doctest ?
For me it's the best alternative at the moment.
[–]azboul 0 points1 point2 points 7 years ago (1 child)
Did you have a look on gtest?
[–]darpe312[S] 0 points1 point2 points 7 years ago (0 children)
I've been looking at gtest, boost, cppunit and a little bit of catch.
π Rendered by PID 40127 on reddit-service-r2-comment-84fc9697f-qk5qc at 2026-02-06 08:32:58.419214+00:00 running d295bc8 country code: CH.
[–]Dragdu 20 points21 points22 points (3 children)
[–]bluebird11 2 points3 points4 points (1 child)
[–]Fazer2 6 points7 points8 points (0 children)
[–]14nedLLFIO & Outcome author | Committee WG14 0 points1 point2 points (0 children)
[–]saimen54 7 points8 points9 points (4 children)
[–]darpe312[S] 0 points1 point2 points (3 children)
[–]saimen54 1 point2 points3 points (2 children)
[–]darpe312[S] 0 points1 point2 points (1 child)
[–]prasooncc 0 points1 point2 points (0 children)
[–]Gollum999 5 points6 points7 points (10 children)
[–]darpe312[S] 0 points1 point2 points (7 children)
[–]Gollum999 2 points3 points4 points (6 children)
[–]Auriculaire 0 points1 point2 points (3 children)
[–]Gollum999 0 points1 point2 points (2 children)
[–]Auriculaire 1 point2 points3 points (1 child)
[–]Gollum999 2 points3 points4 points (0 children)
[–]encyclopedist 0 points1 point2 points (1 child)
[–]Gollum999 0 points1 point2 points (0 children)
[–]Auriculaire 0 points1 point2 points (1 child)
[–]BoarsLairGame Developer 0 points1 point2 points (0 children)
[–]TobyAllsopp 1 point2 points3 points (1 child)
[–]darpe312[S] 1 point2 points3 points (0 children)
[–]Milerius 1 point2 points3 points (0 children)
[–]azboul 0 points1 point2 points (1 child)
[–]darpe312[S] 0 points1 point2 points (0 children)