Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected a warning when no arguments are specified for a parameterized test method #215

Closed
jnm2 opened this issue Apr 26, 2020 · 1 comment · Fixed by #254
Closed

Expected a warning when no arguments are specified for a parameterized test method #215

jnm2 opened this issue Apr 26, 2020 · 1 comment · Fixed by #254
Assignees
Milestone

Comments

@jnm2
Copy link
Contributor

jnm2 commented Apr 26, 2020

There should be a warning that arguments are required.

The warning shouldn't be shown if an attribute is applied to the method that implements the same interface as TestCaseAttribute and TestCaseSourceAttribute or if an attribute is applied to each parameter that implements the same interface as ValuesAttribute and ValueSourceAttribute.

public class C
{
    [Test]
    public void M(int p)
    {
        Assert.That(p, Is.EqualTo(42));
    }
}

Do you think a fix could be nice? I had:

        [Test]
        public static void Examples_from_docs(string path, string encoded)
        {

        }

And maybe there could be a fix that does this:

-       [Test]
+       [TestCase("path", "encoded")]
        public static void Examples_from_docs(string path, string encoded)
        {

        }
@mikkelbu mikkelbu added this to the Release 0.4 milestone May 20, 2020
@mikkelbu
Copy link
Member

Notes:

  • Iterate through the methods. If
    • the method has parameters and
    • the method is marked with an attribute deriving from ISimpleTestBuilder
    • the method is not marked with an attribute deriving from ITestBuilder or at least one parameter is not marked by an attribute deriving from IParameterDataSource
  • then report a problem

Somewhat related to #249

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants