3

Which UnitTest framework should I use to test mixed C++ code (native and C++/CLI)? Any HowTo's or Tutorials?

Thx

leon22
  • 5,280
  • 19
  • 62
  • 100
  • Which unit test frameworks have you used before? – doctorlove Aug 13 '13 at 08:30
  • If you are using VS2012 you can add managed test projects for the C++ CLI projects and the native unit test C++ projects. Add | New Project | Visual C++... – MathiasWestin Aug 13 '13 at 09:27
  • See also: http://stackoverflow.com/questions/14010627/unresolved-externals-when-compiling-unit-tests-for-visual-c-2012/17783030#17783030 – Jochen Kalmbach Aug 13 '13 at 09:34
  • 1
    Test it the same way it is going to be used by client code. Which is pretty likely to be managed code for a C++/CLI library, so use a managed unit test runner. If you want to test the native code then break it apart so you can get to the C++ code. Putting it in a static library that gets linked in the C++/CLI project is boilerplate. – Hans Passant Aug 13 '13 at 10:26

1 Answers1

3

You can use NUnit to test both very easily. If you write the tests in C++/CLI you will be able to test the native code too.
See here for a related discussion.

Community
  • 1
  • 1
doctorlove
  • 18,872
  • 2
  • 46
  • 62