You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tibor Digana (JIRA)" <ji...@apache.org> on 2016/02/10 02:53:18 UTC

[jira] [Commented] (SUREFIRE-1225) Can't run a single parameterized test

    [ https://issues.apache.org/jira/browse/SUREFIRE-1225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15140198#comment-15140198 ] 

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.
https://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html#Multiple_Formats_in_One

> Can't run a single parameterized test
> -------------------------------------
>
>                 Key: SUREFIRE-1225
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1225
>             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/MyTest.java}
> @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
(v6.3.4#6332)