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.
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.
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
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 ;-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With