views:

353

answers:

3

Hello,

we have a huge codebase with about 1000k lines of native/unmanaged legacy c++ - code and we are going to provide the code with unit tests and MSTest would fit perfectly in our current development environment (TFS, VS 2010, ...). I know that MSTest is orginally meant to test managed code but its also possible to write unit tests for unmanaged sc.

Are there any (later) drawbacks on the usage of MSTest for unmanaged code? Does anyone have any experience on this?

The second opinion would be using Google.Test, but I would have to write a Visual Studio add-in to integrate the gtest framework in our environment.

Thanks in advance!

+1  A: 

I would not recommend MSTest for managed testing. See here for my experiences. However if you do insist I would say a really good way to test you legacy code would be use PInvoke interop to your c++ code.

Preet Sangha
Do you have any experience on how Visual Studio enhances the process of testing unmanaged code? I read once in a blog that this should be improved with the new VS version
lakai
Nope I don't sorry.
Preet Sangha
A: 

I use the Boost.Test framework to test my C++ code in Visual Studio without any issues. You need to create a test project (a console-mode EXE) that contains your tests which your main project can depend on. Using the Visual Studio 'post build' step you can run the tests automatically.

Rob
thank you for your comment. test automation is only a one of our "must haves", furthermore the test framework should be directly integrated into VS, e.g. the user should be able to select the tests he/she wants to run or it should deliver useful information like code coverage etc.
lakai
+1  A: 

I would recomment googletest anyway. I think they will also gladly accept your VS integration and include it in the next release, provided the patch has reasonable quality.

Oh, and you can use another great Google project then, gmock.

phjr