We had a case of a missed/skipped test case today:
The developer missed making the [Test]
public and so NUnit (v 3.9.0) didn't didn't run it.
[TestFixture]
public class StackTests
{
[Test]
public void Fail1()
{
Assert.Fail("Will be run");
}
[Test]
void Fail2()
{
Assert.Fail("will NOT be run - none the wiser");
}
}
When the developer noticed that Fail2
wasn't running, he spent another 20 minutes trying to figure out why it wasn't discovered, only to (U+1F926) when we noticed the missing public
.
It has been my experience that the missing public
on NUnit [Test]
methods is a repeated stumbling block and easily missed.
Is there any way to make NUnit or the compiler warn about non-public [Test]
methods?
Or are we stuck with the occasional ?