Skip to content

[Feature]: String arrays in data driven test arguments #6120

Closed

Description

@radmorecameron

Problem Statement

It'd be useful if array parameters can be passed through the Arguments attribute

Proposed Solution

MSTest supports this through a string[] constructor:
https://github.com/microsoft/testfx/blob/191e07b66b2216dc37b857b1e481350293849109/src/TestFramework/TestFramework/Attributes/DataSource/DataRowAttribute.cs#L33

It'd be great if TUnit could support something like:

[Test]
[Arguments(["Chloe"])]
[Arguments(["Skipper", "Lucy"])]
public async Task FavouriteNamesTest(string[] names)
{
...
}

Maybe a constructor like this could be added?

public Arguments(string[] values)
{
...
}

Alternatives Considered

No response

Feature Category

Test Discovery / Attributes

How important is this feature to you?

Nice to have - would improve my experience

Additional Context

No response

Contribution

  • I'm willing to submit a pull request for this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions