Unit Tests Are Not Discoverable

I recently had a situation where I loaded a solution containing a suite of NUnit tests, but the test explorer would not recognise them. The following is a series of checks to make that may cause unit tests to be not visible. Most of these are applicable to all tests:

1. Tests must be declared as public. For example:

        public void MyTestMethod()

2. Tests must be decorated with a test attribute.

For NUnit this is is [Test]:

	        public void MyNUnitTest()

Or [TestCase]:

	        public void MyParameterisedTest(int testNum)

For MSTest this is [TestMethod]:

	        public void MyTestMethod()

3. If using NUnit – check that the correct version is installed (remember that v3 is not an official release yet – that is, at the time of writing).

The current release test adapter is here

The test adaptor for NUnit3 is here

As usual, this is more for my own reference, but if it helps anyone else then all to the good. Also, if you think of or encounter another then please let me know in the comments and I’ll add it on.

This site uses Akismet to reduce spam. Learn how your comment data is processed.