I'm running a project using the following versions
Visual Studio 2026 (18.5.2)
NCrunch (5.21.0.10)
Nunit (4.6.0)
I encountered an issue with a test marked with NUnit's PlatformAttribute. The intention was that these tests would not run when running under Windows.
It seems that NCrunch treats the result of tests so marked as Inconclusive rather than Ignore; consequently, with default settings, the test shows up as being in error (when it simply hasn't run when running on Windows).
I'm aware of the "Consider inconclusive tests as passing" setting but that seems a bit of a blunt instrument in this scenario (I'm perfectly happy with genuinely inconclusive tests showing as errors).
This seems like a potential issue to me; could you please advise?
Code:
namespace VS2022UnitTests
{
[TestFixture]
public sealed class NCrunchIssueTests
{
[Test]
[Platform(Include = "Win", Reason = "Demonstrate test running on Windows")]
public void TestRunsOnWindows()
{
Assert.Pass("This test does run on Windows");
}
[Test]
[Platform(Include = "Linux", Reason = "Demonstrate test running on Linux")]
public void TestRunsOnLinux()
{
Assert.Pass("This test does runs on Linux");
}
[Test]
[Platform(Exclude = "Win", Reason = "Demonstrate test not running on Windows")]
public void TestDoesNotRunOnWindows()
{
Assert.Pass("This test does not run on Windows");
}
[Test]
[Platform(Exclude = "Linux", Reason = "Demonstrate test not running on Linux")]
public void TestDoesNotRunOnLinux()
{
Assert.Pass("This test does not runs on Linux");
}
[Test]
public void TestIsInclusive()
{
Assert.Inconclusive("Demonstrate what happens with an inconclusive test.");
}
[Test]
[Ignore("Show what happens with an ignored test")]
public void TestIsIgnored()
{
Assert.Fail("This test should be ignored");
}
}
The Visual Studio Test runner also appears to have problems distinguishing (tests "TestDoesNotRunOnWindows", "TestsRunsOnLinux" and "TestIsInconclusive" are all marked with Not Run/Blue exclamation mark).
Resharper does better, marking the two excluded platform tests as Ignored. It seems to be able to distinguish from the genuine inconclusive test.