Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resharper Unit Tests not running

I'm trying to get started writing unit tests in a project. I wrote the createTest first and tried it. This test passed and I started writing my other tests.

Now all my tests just say "Test not run". This happens both when I try to run all tests at once and when I run a single test.

https://github.com/Requinard/OperationOctopus/tree/UnitTest

All I've found so far is people using NUnit. We're using the default microsoft testing framework, with resharper running the tests.

    [TestMethod]     public void CreateTest()     {         Init.Initialize();         // set up         UserModel user = new UserModel();          user.Address = "Testing Street 1";         user.Email = "[email protected]";         user.Level = 2;         user.Password = "test";         user.RfiDnumber = "00d0wad0aw";         user.Telephonenumber = "0638212327";         user.Username = "testcaseuser";          Assert.IsTrue(user.Create(), "Cannot write user to database");          test_user = user;     }      [TestMethod]     public void ReadTest()     {         Init.Initialize();         // set up         UserModel user = getTestUser();          Assert.AreEqual(user.Email, test_user.Email, "Reading returned an unexpected result");     }      [TestMethod]     public void AlterTest()     {         Init.Initialize();         UserModel user = getTestUser();          user.Email = "[email protected]";          Assert.IsTrue(user.Update(), "Failure during updating");          user.Read();          Assert.AreNotEqual(user.Email, test_user.Email);     }      [TestMethod]     public void DestroyTest()     {         Init.Initialize();         UserModel user = getTestUser();          Assert.IsTrue(user.Destroy(), "Could not destroy user");     } 

The above tests will make resharper say "Test not run"

I just tried running the tests on my laptop. They worked without any changes to the code and the test completed instantly. This leads me to think I'm dealing with a faulty config somewhere.

like image 295
requinard Avatar asked Apr 13 '15 19:04

requinard


People also ask

How do I enable ReSharper?

In the Visual Studio menu, choose ReSharper | Options. In the Options dialog that appears, select a node in the left pane and configure settings in the right pane.


2 Answers

I think restarting the whole system may have been a little premature. I have found when this happens all you need to do is restart Resharper.

I usually do this from the Command Window in Visual Studio , you just need to type these commands one after the other

Resharper_Suspend Resharper_Resume 

this generally fixes the problem for me and doesn't require reopening the solution.

If this fails you can clear the resharper caches. Information can be viewed here on how to do that.

here is how to do it from VS menu

like image 97
BastanteCaro Avatar answered Sep 20 '22 17:09

BastanteCaro


Make sure you aren't doing what I was doing and completely forget that solution is in release mode with test project set to build only in debug mode ;-)

like image 27
Ted Avatar answered Sep 24 '22 17:09

Ted