views:

938

answers:

3

I have a large project for which I am attempting to use TDD. I am using Tut as my test framework, which has its flaws but is sufficient for what I need.

I need to exploit link time test seams, each test must be in its own executable. The project for this executable then launches itself as a post build step.

Unfortunately, this means that my Visual Studio Sln is filling up with tests, which is not scalable and also hides the actual important projects.

Does anyone know of a better way of running these tests? Is it possible to hide projects from a build and yet still have them build?

+4  A: 

"Is it possible to hide projects from a build and yet still have them build?"

You can make separate solution for test cases. Then you can set up post build step of your main projects. This post-build should build tests-projects via separate solution and run them. Building test-projects should be done via command line (see e.g. here for details).

If you need to link your unit tests with some lib-s from main projects, you can use

#pragma comment(lib, "libname")

See this MSDN page for details.

sergdev
I like the idea of creating a separate sln, hopefully I can make them share obj files.
Dave Hillier
I didn't try to share obj-s... Good luck :)
sergdev
A: 

You could try to group your tests into folders (are they called filters?) within your solution in Solution Explorer. This would separate tests from your other projects.

But, otherwise, could you avoid using link time test seams (Yes, I know, its probably too late to suggest this) and use polymorphism to provide your run-time variation and have less test projects?

quamrana
A: 

Don't know if you're still looking for a solution. But here's an idea:

You can keep all your tests in one library and write an application that spawns itself and executes each test. This way you end up with one executable (and hence one project) for a suite and each test will be like a separate executable.

This is in-fact the mechanism used in CUnitWin32. You might even be able to wrap your tests in that framework.

Dushara