What are skipped tests in visual studio?
Asked Answered
P

12

42

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:

Skipped Tests

Pitterpatter answered 11/10, 2012 at 12:54 Comment(13)
Do you have a test settings file?Bowlds
Yes, i have TestSettings.testsettings file.Pitterpatter
Is the test settings file specifying which tests to run? Mainly, under Folders, is the folder where your tests are located included?Bowlds
Where can i find it, can you show screenshot?Pitterpatter
try thisBowlds
The screenshot doesn't look like Visual Studio's default test runner. What IDE/Test runner is this?Gravely
I have installed Resharper, but it have his own "Unit test Sessions" window.Pitterpatter
Thank you kevin_fitz. I didn't read everything you said but just your questioning about whether he has a test settings file led me to solve my own issue. My tests were skipping because I had accidentally left 'remote execution' on in my test settings files which was fine before but now and I was intending on local execution.Babs
I know it's been a while, but have you managed to solve this? I've run into the same issue, and i can't find a solution anywhere.Claymore
Are these tests written using MSTest framework? Or do they use NUnit. xUnit.NET or other frameworks. If yes would you install the corresponding test runner plugin?Squishy
@Claymore did you manage to solve this problem?Squishy
This sounds weird but I get this problem on Windows 10 with Visual Studio 2015, but it works fine with the exact same project copy/pasted over to Windows 7 with the same version of Visual StudioClannish
After a reboot (of the whole computer, not just Visual Studio) the problem seemed to go away for me.Clannish
A
34

Check if the test has a Ignore attribute.

Adair answered 21/7, 2014 at 9:46 Comment(2)
Running SpecFlow tests with Ignore attribute will make Test Explorer skipping the testsAviles
I just would like to add a note to pay attention that Ignore attribute can either be applied in methods and classes.Referential
D
8

Tests which use the Inconclusive result will appear as skipped. So VS 2010 inconclusive == VS 2012 skipped

ex:

Assert.Inconclusive("This test didn't exactly fail, but we can't be certain the results are good.")

Will read as skipped in the test window

Darrin answered 16/7, 2014 at 20:8 Comment(0)
J
5

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.

Jezreel answered 6/10, 2014 at 19:38 Comment(0)
H
4

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.

Hapsburg answered 21/2, 2017 at 22:39 Comment(2)
I've had similar issues when an Exception is thrown from the ClassInitialize, class constructor, or even default initialized attributes.... Not the case this time as I am hitting this issue with an empty class.Johannejohannes
Maybe its skipped it Because its empty. There seems to be plethora of reasons why this happens, Personally I think Test32 neds an upgrade. I have a project where I can't debug tests. All seems a bit flaky.Hapsburg
F
3

In addition to what's been mentioned here, check that the TestClass does not also have the Ignore attribute (not just the test method.) This bit me once...

Formic answered 24/10, 2018 at 23:5 Comment(0)
J
3

Also caused by testing a 64-bit project but test->Test Settings->Default Processor Architecture=x86

Jaclin answered 5/9, 2019 at 13:41 Comment(0)
S
2

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:

[TestCategory("Admin") TestMethod()]
public Void Test1()
{
   ...
}

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

Surefooted answered 10/7, 2013 at 19:23 Comment(0)
C
1

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.

Cataract answered 20/10, 2015 at 8:15 Comment(0)
B
1

I had a setup script defined in my TestSettings.testsettings file that did not exist on my development machine.

<Scripts setupScript="C:\Deployment\UnitTestSetup.cmd" />
Bs answered 14/9, 2020 at 10:20 Comment(1)
This was the problem for me, and it didn't give me any message about it. It just skipped the test until I removed the script from the testrunconfig file.Striker
T
0

In xUnit, tests marked with FactAttribute for which Skip property is set to something are skipped.

Tegan answered 1/11, 2019 at 12:38 Comment(0)
V
0

Might not be relevant for this exact case, but if none of your NUnit tests are running in the test explorer and they are being skipped, you might want to check if you have Microsoft.Net.Test.Sdk nuget installed. It is needed.

enter image description here

Vainglory answered 7/9, 2023 at 3:43 Comment(0)
P
0

So, in Visual Studio Professional 2022, this was happening to me, because I was in "Folder View" instead of "Solution View."

In the Solution Explorer (right side of the screen in my setup), at the top, there's a button that lets you switch between viewing the solution as a .sln file (and all associated files), or simply viewing things as a folder tree.

enter image description here

For some reason, when I was in "Folder View," three of my 72 tests were skipped silently. Even clicking on them in the Test Explorer and manually choosing "Run" did nothing. However, switching views as described above via the Solution Explorer did the trick.

Peekaboo answered 19/6 at 12:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.