Problem
I have a test class, and I’ve included an example test from that class below.
namespace AdminPortal.Tests.Controller_Test.Customer
{
[TestClass]
public class BusinessUnitControllerTests
{
private IBusinessUnitRepository _mockBusinessUnitRepository;
private BusinessUnitController _controller;
[TestInitialize]
public void TestInitialize()
{
_mockBusinessUnitRepository = MockRepository.GenerateMock<IBusinessUnitRepository>();
_controller = new BusinessUnitController(_mockBusinessUnitRepository);
}
[TestCleanup]
public void TestCleanup()
{
_mockBusinessUnitRepository = null;
_controller.Dispose();
_controller = null;
}
#region Index Action Tests
[TestMethod]
public void Index_Action_Calls_GetAllBusinessUnit()
{
_mockBusinessUnitRepository.Stub(x => x.GetAllBusinessUnit());
_controller.Index();
_mockBusinessUnitRepository.AssertWasCalled(x=>x.GetAllBusinessUnit());
}
}
}
When I run the project, I see the screen below.
I double-checked the references and found that the test project contains a link to the main project. Do you have any idea why the tests aren’t running or why they’re stating that they’re inconclusive?
Edit 1:
I saw a post here and adjusted the default processor architecture in my test settings to X64, but it still doesn’t work.
Asked by Cybercop
Solution #1
I fixed my instance of this error by identifying a faulty entry in my App, just in case none of the preceding methods worked for anyone. Due to a missing nuget package in the test project, configuration is required.
Answered by Chris Pacey
Solution #2
It was aggravating for me, but I think I’ve figured out a solution for my situation:
Your TestMethod can’t be void if it’s async. It is required to return Task.
I hope it becomes useful to someone:)
Answered by Krzysztof Skowronek
Solution #3
I experienced the similar problem with resharper, and I was able to fix it by changing a setting:
Options => Tools => Unit Testing in Resharper
All I had to do was uncheck the “Shadow-copy assemblies being tested” option.
Answered by Elias Platek
Solution #4
It was a problem with Resharper. I unchecked the Use Legacy Runner box under Resharper options->Tools->MSTEST, and it now works.
Answered by Cybercop
Solution #5
I had similar issue with Resharper Ultimate 2017.2 and VS 2017 Update 3.
Restarting the machine or restarting the vs can’t help.
I was able to fix the issue by emptying the cache as follows:
Resharper ->options-> Environment ->click the button 'Clear caches'
Update:
In the upper right corner of the test window, there is a “error” button (which I found in Resharper 2018).
When you click the error button, an error message appears that may assist you in addressing the issue.
Run Visual Studio in log mode to find the source of the problem. Run the following command in vs 2017:
devenv /ReSharper.LogFile C:\temp\log\test_log.txt /ReSharper.LogLevel Verbose
Run the test.
Examine the log file test log.txt and look for the word ‘error’.
The log file can be used to assist you discover the fault and rectify it, or you can email the issue to Resharper’s technical support team.
Answered by M.Hassan
Post is based on https://stackoverflow.com/questions/18311108/test-method-is-inconclusive-test-wasnt-run-error