maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Gudian (JIRA)" <j...@codehaus.org>
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

    [ https://jira.codehaus.org/browse/SUREFIRE-1058?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=340973#comment-340973
] 

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
minutes).

> TestSetFailedException trying to use maven-surefire-plugin + regular expressions for
TestNG groups
> --------------------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-1058
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-1058
>             Project: Maven Surefire
>          Issue Type: Improvement
>          Components: TestNG support
>    Affects Versions: 2.16
>            Reporter: Tracey Ruark
>            Assignee: Andreas Gudian
>             Fix For: 2.17
>
>         Attachments: Surefire1058BugExample.zip
>
>
> 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="foo.bar.something"{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="foo.bar.*"{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(NativeMethodAccessorImpl.java:57)
> [ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> [ERROR] at java.lang.reflect.Method.invoke(Method.java:601)
> [ERROR] at org.apache.maven.surefire.testng.TestNGExecutor.getGroupMatchingSelector(TestNGExecutor.java:172)
> [ERROR] at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:66)
> [ERROR] at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:204)
> [ERROR] at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:107)
> [ERROR] at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:113)
> [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
> [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
> [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
> [ERROR] Caused by: org.apache.maven.surefire.group.parse.TokenMgrError: Lexical error
at line 1, column 13.  Encountered: <EOF> after : ""
> [ERROR] at org.apache.maven.surefire.group.parse.GroupMatcherParserTokenManager.getNextToken(GroupMatcherParserTokenManager.java:468)
> [ERROR] at org.apache.maven.surefire.group.parse.GroupMatcherParser.jj_scan_token(GroupMatcherParser.java:527)
> [ERROR] at org.apache.maven.surefire.group.parse.GroupMatcherParser.jj_3_7(GroupMatcherParser.java:274)
> [ERROR] at org.apache.maven.surefire.group.parse.GroupMatcherParser.jj_3R_3(GroupMatcherParser.java:287)
> [ERROR] at org.apache.maven.surefire.group.parse.GroupMatcherParser.jj_3_3(GroupMatcherParser.java:279)
> [ERROR] at org.apache.maven.surefire.group.parse.GroupMatcherParser.jj_3R_1(GroupMatcherParser.java:320)
> [ERROR] at org.apache.maven.surefire.group.parse.GroupMatcherParser.jj_3_1(GroupMatcherParser.java:335)
> [ERROR] at org.apache.maven.surefire.group.parse.GroupMatcherParser.jj_2_1(GroupMatcherParser.java:179)
> [ERROR] at org.apache.maven.surefire.group.parse.GroupMatcherParser.expr(GroupMatcherParser.java:63)
> [ERROR] at org.apache.maven.surefire.group.parse.GroupMatcherParser.parse(GroupMatcherParser.java:56)
> [ERROR] at org.apache.maven.surefire.testng.utils.GroupMatcherMethodSelector.setGroups(GroupMatcherMethodSelector.java:83)
> [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.
> [ERROR]
> {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 "http://testng.org/testng-1.0.dtd" >
> <suite name="foosuite">
>     <parameter name="environment"  value="dev"/>
>     <test name="footest">
>         <groups>
>             <run>
>                 <include name="foo.bar.*"/>
>             </run>
>         </groups>
>         <packages>
>             <package name="com.foo.bar.somepackage.*"/>
>         </packages>
>     </test>
> </suite>
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Mime
View raw message