views:

516

answers:

3

Hey all.

I have CLI/MFC application and I would like to begin to learn how to unit test with it. I have VS2008 Pro. If possible, I would like to use the built in unit testing. Thanks for your input!

+1  A: 

I've had success with both CPPUnit and Google Test. For either you have to do a bit of work to get the test results to integrate back into Studio. The granularity of the results you want directly affects how much work. Do you want a pass/fail for the whole test set, or individual results? The former is a simple msbuild task, the latter requires outputting the result set to XML, massaging that with a transform, then pulling it back in.

ctacke
For either of these, are there ways to test the CLI side of the application?
Daniel A. White
I've never tried, but probably not. mstest can already handle managed C++.
ctacke
Are there any examples of doing the latter, (that is, outputting the results to XML and loading them back in to VS)?
Jared
A: 

We use Gallio & MbUnit to test our MFC & C++/CLI application. Simply write the tests in C++/CLI then you can test both managed and unmanged code in a single framework. We also use NMock2 for mocking the managed code.

Colin Desmond
A: 

If you have Team Test edition, you can use it to test C++/CLI applications and libraries. See here.

Aidan Ryan