Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-1250

Regex testcase filtering: exception when hashmark is regex-quoted

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.19.1
    • 2.20
    • Maven Surefire Plugin
    • None

    Description

      i've been using regex to select which tests to run...and i've got some wierd exceptions when executing

      mvn test "-Dtest=%regex[.*\Q#\E.*]"
      

      executing the above command results in:

      java.util.regex.PatternSyntaxException: 
      Illegal/unsupported escape sequence near index 1
      \E.*
       ^
      	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:364)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161)
      
      

      i noticed earlier that maven might do some black-magic with these regexps in the background ( i know that it should know the class name earlier; to avoid starting testcases which will get entirely excluded...and thats cool )

      ...so..i assume maven does split the regex by the #; and that's okay - if that can't be avoided; place some pointers in the documentation about it and/or a more descriptive exception could be useful

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            tibordigana Tibor Digana
            kgyrtkirk Zoltan Haindrich
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment