Skip to content

Standardise behaviour of params and optional arguments across parameterised attributes #2268

@ChrisMaddock

Description

@ChrisMaddock

NUnit has various parameterised arguments, which make various special conversions to adjust parameters to match method signatures, to allow invocation via reflection. The key ones I'm thinking of are [TestCase()], [TestCaseSource()], [TestFixture()] and [TestFixtureSource()].

Support for params and optional arguments between these attributes is inconsistent. Over the years, this has raised various issues:
#1281 (open)
#1883 (open)
#1459 (open)
#1640
#1278
#1282
#257

We've talked in a couple of places (link 1, link 2, link 3) about harmonising this functionality, and having a single utility class, which resolves parameters passed to attributes, and ensures they are handled in a standard manner across all attributes. As I remember - this was something we agreed to go ahead with - @Yarmonov started on a PR in #2104. (This seems to have gone stale, unfortunately. Will check in on it shortly.) This would mean that the params keyword and optional arguments would be handled in a standard fashion across all of these attributes, meaning no unexpected surprises for the end-user.

I wanted to create a master issue for this whole idea - as some of the existing open issues are tagged easyfix - and I didn't want anyone to end up implementing any more solutions individually, when we actually want to be sharing the existing functionality between attributes. If @nunit/framework-team agree - I'd like to close the open issues above, and use this as a single issue to reflect the overall plan.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions