79187159

Date: 2024-11-14 01:56:24
Score: 1
Natty:
Report link

The accepted answer is no longer up to date.

There is now the (seemingly undocumented) Microsoft.VisualStudio.TestTools.UnitTesting.DiscoverInternalsAttribute which can be added to your assembly to allow the test adapter to discover internal test classes and methods.

I discovered this by looking at the source code:

https://github.com/microsoft/testfx/blob/main/src/TestFramework/TestFramework/Attributes/Lifecycle/Initialization/DiscoverInternalsAttribute.cs

The XmlDoc states:

/// <summary>
/// The presence of this attribute in a test assembly causes MSTest to discover test classes (i.e. classes having
/// the "TestClass" attribute) and test methods (i.e. methods having the "TestMethod" attribute) which are declared
/// internal in addition to test classes and test methods which are declared public. When this attribute is not
/// present in a test assembly the tests in such classes will not be discovered.
/// </summary>
Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Django-S