Skip to content

TestCaseSource that contains Exception with InnerException - not running tests #4659

@konrad-gora

Description

@konrad-gora

After updating NUnit 3 to NUnit 4 (4.1.0) my test cases with InnerException are not run. I'm using TestAdapter 4.5.0

[FixtureLifeCycle(LifeCycle.InstancePerTestCase)]
public class Tests1
{
    [TestCaseSource(nameof(GetSomeExceptionCases))]
    public void NoMethod_GivenException_ShouldPassTest(Exception testCase) => testCase.Should().NotBeOfType<string>();

    public static TestCaseData[] GetSomeExceptionCases() =>
    [
        new TestCaseData(new ArgumentNullException()),
        new TestCaseData(new ArgumentNullException("message", new Exception())),
    ];
}

image

When I downgrade NUnit to 3.14.0, both tests are passing.
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions