I tried to run Visual Studio tests in ASP.NET MVC by pressing "Run All" but all tests were skipped. Why did this happen and how can I run all tests? Here is a screenshot:
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- MVC-Routing,Why i can not ignore defaults,The matc
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
I know this is an old issue and there's no accepted answer, but maybe this will help someone.
In Test Explorer (Tests -> Windows -> Test Explorer), you can see all the tests that were skipped. If you double-click on test name, it will open the actual Test code. Check if the test has an [Ignore] attribute and remove it if you want to run the test. (as @Sridarshan suggested)
P.S. I had NUnit tests.
Also caused by testing a 64-bit project but test->Test Settings->Default Processor Architecture=x86
Tests which use the
Inconclusive
result will appear as skipped. SoVS 2010 inconclusive == VS 2012 skipped
ex:
Will read as skipped in the test window
The Test Settings file you're pointing to could be invalid. Make sure the settings file has the right parameters (either remote or local, etc.), and then go to
Tests>Test Settings>Select Test Settings File
in the toolbar to select the valid file.I got this in VS 2015, along with QTAgent32 stopped working etc. Turned out to be nothing to do with test settings and was in fact a stack overflow (I kid you not) in the class I was testing.
I had several tests failing, and a whole swathe of others skipped when the agent went down. I commented out all the tests in the impacted area, until run all worked, then pulled them back in until a fail, then to see the actual SO exception I had to debug the test.
Then I face palmed a few times and fixed it. Unlikely scenario, but you never know.
Assuming that one of your tests beforehand didn't fail, your tests may have been skipped due to insufficient privileges.
You can use the "TestCategories" annotation on your tests. Mark them with:
And then exclude the category:
mstest /testcontainer:MyTestprojectName.dll /category:"!Admin"
You can use multiple categories on each test. For in-depth info: http://msdn.microsoft.com/en-us/library/dd286683.aspx