maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tibor Digana (JIRA)" <>
Subject [jira] [Commented] (SUREFIRE-1225) Can't run a single parameterized test
Date Wed, 10 Feb 2016 01:53:18 GMT


Tibor Digana commented on SUREFIRE-1225:

Surefire did exactly as you said. Sometimes the developers rely on wrong behavior of previous
version of Surefire. The pattern internally does not make any assumptions and does not need
to add wildcard after #testWithParameters. That's maybe what the user should do and then Surefire
algorithms are more strict in finding the matching method names.
The problem is that the method name is not the one you can see in sources. To understand this
the user needs to have a little knowhow of JUnit internals because the test method is always
{{described}} with different name if using {{Parameterized}}. The reason is simple in JUnit
so that every test must have a unique {{Description}} and because parameterized tests could
break this rule if using always the same method name, the JUnit runner added brackets behind
your test.
Please read our documentation. You have two option, use wildcard or brackets after method
name in the pattern.

> Can't run a single parameterized test
> -------------------------------------
>                 Key: SUREFIRE-1225
>                 URL:
>             Project: Maven Surefire
>          Issue Type: Bug
>    Affects Versions: 2.19.1
>            Reporter: Dmitry Baev
> The sample test to reproduce the problem:
> {code:java|title=com/github/baev/}
> @RunWith(Parameterized.class)
> public class MyTest {
>     @Parameterized.Parameters
>     public static Collection<Object[]> data() {
>         return Arrays.asList(
>                 new Object[]{},
>                 new Object[]{}
>         );
>     }
>     @Test
>     public void testWithParameters() throws Exception {
>     }
> }
> {code}
> and then run 
> {{clean test -Dtest=com.github.baev.MyTest#testWithParameters}}
> The output is
> {{Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test)
on project surefire-base-test-bug: No tests were executed!}}
> Is it expected?

This message was sent by Atlassian JIRA

View raw message