small medium large xlarge

30 Apr 2013, 14:40
Richard Hagberg (10 posts)

I am new to TDD and have been reading TDDfEC and trying to apply it’s concepts for an application I came up with just to test it out. I am using CppUTest in Visual Studio 2008 Express. Things were going pretty good until I finished all my tests for a module, and wanted to move on to testing a module that the already tested module was a collaborator of. I replaced the collaborator with a spy using preprocessor substitution, but that meant that all the tests for the collaborator unit were now testing the spy. I hadn’t thought about this before, but had always assumed that all the tests would run in the same solution, but now I can’t see a way to make this work. Is this impossible, or is there some trick to making all the tests to play nice with each other? The only other solution I can see is to have different solutions for each module that contains all the tests for that module. I was just wondering what everyone does. Thanks in advance.

04 Jun 2013, 14:21
Arnd R.Strube (88 posts)

Hello Richard.

I do not personally use MSVC. The general principle, however, should be the same.

Your solution is a container for many projects (I think that’s what MSVC calls these, too; “Solution” tends to be called “Workspace” elsewhere). This is not necessarily obvious, because MSVC automatically creates a solution along with the (first) new project.

You will soon find - as you did - that you need one test project for each module. All these projects can, however, happily co-exist in the same solution.

Sorry I can’t help you with the exact steps how to add more projects to your solution, since I don’t have MSVC installed at the moment. You may need a bit of tweaking to get the directory structure you want etc.


You must be logged in to comment