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

Improperly configured @ParameterizedTest should fail instead of being disabled #923

Closed
3 tasks done
sbrannen opened this issue Jul 7, 2017 · 2 comments
Closed
3 tasks done

Comments

@sbrannen
Copy link
Member

sbrannen commented Jul 7, 2017

Overview

Currently, if a @ParameterizedTest is not configured properly (at least as demonstrated below), it will be silently disabled; whereas, the improper configuration is actually an error.

For example, the following test configuration...

@ParameterizedTest
@CsvSource({})
void parameterizedTest(String str1, String str2) {
}

... results in:

org.opentest4j.TestAbortedException: No supporting TestTemplateInvocationContextProvider provided an invocation context

... but the above is clearly a user error and not the result of a missing TestTemplateInvocationContextProvider.

Related Bug

(perhaps worthy of a separate issue)

The following configuration...

@ParameterizedTest
@CsvSource({""})
void parameterizedTest(String str) {
}

... does not result in the test being disabled but rather fails the test with the following error, which is vague at best. What is null? I don't see anything null. I see an empty string, but that's not the same as null.

org.junit.platform.commons.util.PreconditionViolationException: argument array must not be null

It turns out that the above example can be fixed by specifying an empty string as '' within the double quotes (as follows), but I don't think anyone can be expected to infer that as the solution to the null claim in the exception that is thrown.

@ParameterizedTest
@CsvSource({"''"})
void parameterizedTest(String str) {
}

Deliverables

  • Investigate which uses cases leading to "No supporting TestTemplateInvocationContextProvider" are actually user configuration errors.
  • Fail parameterized tests that are improperly configured.
  • Improve exception messages for scenarios such as the above "argument array must not be null" case.
@marcphilipp
Copy link
Member

in progress

@marcphilipp
Copy link
Member

Done in master. Please see above commits for details.

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

No branches or pull requests

2 participants