maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Gudian (JIRA)" <>
Subject [jira] (SUREFIRE-1058) TestSetFailedException trying to use maven-surefire-plugin + regular expressions for TestNG groups
Date Mon, 10 Feb 2014 20:54:57 GMT


Andreas Gudian commented on SUREFIRE-1058:

That's something that was never intended to work, at least that's how it looked in the code.

I've added some rudimentary support for passing in regular expressions. Rudimentary means:
you can specify the {{\*}} and escape the {{.}} dot and the {{\*}} with \. The following characters
are still not supported: {{[ ] + ? ^}}

For allowing the rest of regular expressions (especially groups, as parenthesis already have
some other meaning), someone would have to do some lifting in the javacc parser declaration
and make sure you can't specify illegal groups for JUnit - or cleanly separate both. Anyways,
that's not something that I'm looking forward to do. Pull-Requests are welcome, though...

You can give this a try in the 2.17-SNAPSHOT (should be deployed within the next couple of

> TestSetFailedException trying to use maven-surefire-plugin + regular expressions for
TestNG groups
> --------------------------------------------------------------------------------------------------
>                 Key: SUREFIRE-1058
>                 URL:
>             Project: Maven Surefire
>          Issue Type: Improvement
>          Components: TestNG support
>    Affects Versions: 2.16
>            Reporter: Tracey Ruark
>            Assignee: Andreas Gudian
>             Fix For: 2.17
>         Attachments:
> I have a Maven project with parent -> child poms. Each child project has TestNG tests.
What I'd like to be able to do is use regular expressions on the TestNG group and execute
tests across projects which match the given regex.
> Running TestNG tests using a non-regular expression group across projects works just
fine. For example this works:
> {noformat}mvn test -DargLine="-Denvironment=test" -Dgroups=""{noformat}
> This runs the correct test methods which have that exact tag across all my child projects.

> However if I do something like this:
> {noformat}mvn test -DargLine="-Denvironment=test" -Dgroups="*"{noformat}
> I get this exception:
> {noformat}
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test
    (default-test) on project test-automation-ui: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test
failed: There was an error in the forked process
> [ERROR] org.apache.maven.surefire.testset.TestSetFailedException: null; nested exception
is java.lang.reflect.InvocationTargetException: null
> [ERROR] java.lang.reflect.InvocationTargetException
> [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(
> [ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> [ERROR] at java.lang.reflect.Method.invoke(
> [ERROR] at org.apache.maven.surefire.testng.TestNGExecutor.getGroupMatchingSelector(
> [ERROR] at
> [ERROR] at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(
> [ERROR] at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(
> [ERROR] at org.apache.maven.surefire.testng.TestNGProvider.invoke(
> [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(
> [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(
> [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(
> [ERROR] Caused by: Lexical error
at line 1, column 13.  Encountered: <EOF> after : ""
> [ERROR] at
> [ERROR] at
> [ERROR] at
> [ERROR] at
> [ERROR] at
> [ERROR] at
> [ERROR] at
> [ERROR] at
> [ERROR] at
> [ERROR] at
> [ERROR] at org.apache.maven.surefire.testng.utils.GroupMatcherMethodSelector.setGroups(
> [ERROR] ... 12 more
> [ERROR] -> [Help 1]
> [ERROR] 
> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> {noformat}
> If I use the bypass surefire and run TestNG directly using same regular expression in
a testng.xml suite file it works just fine:
> {noformat}
> <!DOCTYPE suite SYSTEM "" >
> <suite name="foosuite">
>     <parameter name="environment"  value="dev"/>
>     <test name="footest">
>         <groups>
>             <run>
>                 <include name="*"/>
>             </run>
>         </groups>
>         <packages>
>             <package name="*"/>
>         </packages>
>     </test>
> </suite>
> {noformat}

This message was sent by Atlassian JIRA

View raw message