Skip to content

Running tests directly should never surface a NullReferenceException #2242

Closed
@jnm2

Description

@jnm2

We're gathering a few bug reports around this issue. People try to manually run or debug an NUnit test and get a NullReferenceException. This sends the message to the user that this is a bug we do not know about. It would be better if we surfaced an exception with a helpful message getting the user on the right track.

Even better than that, I wish we could fall back gracefully and continue. That is going to be the user's expectation and it allows conveniences during development such as ad-hoc debugging into a test on F5 like what's manually done here:

public static class Program
{
    public static void Main() => new TheFixture().TheTest();
}

[TestFixture]
public sealed class TheFixture
{
    [Test]
    public void TheTest() => Assert.That(...);
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions