views:

2314

answers:

5

I changed the output path of the test project, because the default path doesn't conform to our projects directory structure. After I did that, Visual Studio 2008 fails to run the tests, because it can't find the Unit Test project assembly.

What else do I have to change for the Unit Test Engine to find the assembly?

A: 

If you open up your .testrunconfig file and go to the Deployment option, you can add your test assembly to the list of files to deploy. You should then be able to run your tests.

Ty
A: 

I figured this out, I think.

This is the only solution I have found. Adding the assembly to the files to deploy list (as suggested by Ty) works, but it kind of feels dirty, so I didn't want to do that.

Visual Studio accepts the changed path, only when you change it before running any of the tests. So, the solution to my own question is: You have to create a new test project, change it's build path, add all of the tests from the old test project.

Paulius Maruška
+1  A: 

There are at least three ways to solve this problem

  1. Set up the output path before you run any test in the solution (as suggested by Paulius Maruška).
  2. Close the solution, delete the directory TestResults (under your solution folder) and then open the solution and run all tests (Test -> Run -> All...)
  3. Add your assembly to the list of files to deploy in the .testconfig file (suggested by Ty)

Solution number 3 is probably not recommended, since solution 1 or 2 will achieve the same without adding a second reference to the output path.

Please note that solution number 2 will delete any test history you may have.

Magnus Akselvoll
A: 

Close your project, then delete your hidden .suo file and the csproj.user file. Then re-open the project. That fixes it.

A: 

That rather causes Visual Studio to crash instead since it loses track of the tests :).

Fayssal