3

I want to get started on Unit Testing in C++ (pure C++, not .NET), since I have never done it before. Always used assert and cout. So far, the only good Question with detailed answers, I have found is https://stackoverflow.com/questions/13699/choosing-a-c-unit-testing-tool-framework, but it is dated to 2008.

I would like to hear some opinions about currently available C++ Unit Testing compatible with Visual Studio 2012. What are their Cons and Pros ? How easy/hard to learn them(i.e availability of learning materials) ? How Popular they are ? Are they being actively developed, supported ?

There are several frameworks that I am aware of: Google's Testing Framework, Boost Testing Lib.

(Also, in addition to Visual Studio, I use Intel Parallel Studio XE 2013, primarily for static analysis)

Community
  • 1
  • 1
newprint
  • 6,936
  • 13
  • 67
  • 109
  • 2
    It's hard to go wrong with the built in tools if you just want to start out and test a few things. Some things (like new results each opening a new tab) are a bit primitive, but it mostly gets the job done. `File->New->Project->Visual C++->Test->Test Project`. –  Aug 20 '13 at 17:55
  • ebyrob, is it for C++ or C# ? – newprint Aug 20 '13 at 17:59
  • C++, but you can create C# test projects as well. – Kindread Aug 20 '13 at 18:10
  • 1
    It's C++/CLI. If you need pure C++ I know CppUnit used to be pretty decent. PS - If you're using `cout`, might I suggest log4cpp or one of it's cousins? –  Aug 20 '13 at 20:06

2 Answers2

1

I use TUT unit testing framework: http://tut-framework.sourceforge.net/

vand777
  • 11
  • 1
1

At the moment we only use the unit testing functionality which comes with VS12 (Premium). We also tested other Frameworks (e.g. NUnit), but for now VS12 testing suits well.

Micha
  • 5,117
  • 8
  • 34
  • 47