richard richard - 1 month ago 21
C# Question

Why does visual studio 2012 not find my tests?

I have some tests that use the built in

Microsoft.VisualStudio.TestTools.UnitTesting
, but can not get them to run.

I am using visual studio 2012 ultimate.

I have a solution of two projects; One has tests,
using Microsoft.VisualStudio.TestTools.UnitTesting
,
[TestClass]
before the class,
[TestMethod]
before the test methods and reference
Microsoft.VisualStudio.QualityTools.UnitTestFramework
(version 10.0.0.0, runtime version v2.0.50727). I have tried dot-net framework 3.5, 4 and 4.5 others give a re-targeting error.

I have tried to build the solution and project. Test explorer has the message `Build your solution to discover all available tests. Click "run all" to build, discover, and run all tests in your solution.

So the question is: How to I get visual studio to find the tests?




Have also tried to follow this: http://msdn.microsoft.com/en-US/library/ms379625%28v=VS.80%29.aspx but with no success: I get stuck in section getting started, when asked to right click and select
create tests
. There is no
create tests
.




I have this test(it compiles, but does not show up in test explorer):

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace tests {
[TestClass]
public class SimpleTest {
[TestMethod]
public void Test() {
Assert.AreEqual("a","a", "same");
}
}
}





I have now discovered (see deleted answer below) that it is because it is on a shared drive, but I don't as yet know how to get around it. (something about the security setting maybe).

Answer

The problem was that the test runner, is configured to not run tests from a remote drive. When I copied the project to a local drive it worked fine, but I needed it on a shared drive (can not remember why).

I read that it can be configured to work from a shared drive, but never got to do it as by the time I discovered the solution I had switched to MonoDevelop on Debian.