You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Johannes Carl?n (JIRA)" <ji...@codehaus.org> on 2006/06/12 12:47:41 UTC

[jira] Created: (MSUREFIRE-135) Excluding tests with command line pattern

Excluding tests with command line pattern
-----------------------------------------

         Key: MSUREFIRE-135
         URL: http://jira.codehaus.org/browse/MSUREFIRE-135
     Project: Maven 2.x Surefire Plugin
        Type: New Feature

    Versions: 2.2    
 Environment: All environments running JUnit tests
    Reporter: Johannes Carlén


I'd like to be able to exclude certain tests from being run. An example of this could be a scenario where I'd like just the unit tests and not the integration tests to run. In our case, we name all integration test with the postfix "IntTest" instead of just "Test".

This is now possible through configuring the plugin in the pom, however it is not possible to decide at the command line if I just like to run some tests and not all.

Example of use with this implementation would be:
mvn -Dexclude=*IntTest test
which would run all tests - excluding those that ends with IntTest

The amount of code needed for implementation is minimal. In SurefirePlugin.java:

Just add a property - something like:

    /**
     * Specify this parameter to exclude test by their name. It follows
     * the same conventions as the <code>test</code> parameter.
     * 
     * @parameter expression="${exclude}"
     * 
     */
    private String exclude;

Add this code at line 527

                if ( this.exclude != null )
                {   
                    String exclude = "**/" + this.exclude + ".java";
                    excludes.add(exclude);
                    getLog().debug( "Excluding test with pattern :" + exclude );
                }

...and that's all.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Moved: (SUREFIRE-131) Excluding tests with command line pattern

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brett Porter moved MSUREFIRE-135 to SUREFIRE-131:
-------------------------------------------------

    Affects Version/s:     (was: 2.0 (2.2 plugin))
                       2.0 (2.2 plugin)
        Fix Version/s:     (was: 2.3)
                       2.3
                  Key: SUREFIRE-131  (was: MSUREFIRE-135)
              Project: Maven Surefire  (was: Maven 2.x Surefire Plugin)

> Excluding tests with command line pattern
> -----------------------------------------
>
>                 Key: SUREFIRE-131
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-131
>             Project: Maven Surefire
>          Issue Type: New Feature
>    Affects Versions: 2.0 (2.2 plugin)
>         Environment: All environments running JUnit tests
>            Reporter: Johannes Carlén
>             Fix For: 2.3
>
>
> I'd like to be able to exclude certain tests from being run. An example of this could be a scenario where I'd like just the unit tests and not the integration tests to run. In our case, we name all integration test with the postfix "IntTest" instead of just "Test".
> This is now possible through configuring the plugin in the pom, however it is not possible to decide at the command line if I just like to run some tests and not all.
> Example of use with this implementation would be:
> mvn -Dexclude=*IntTest test
> which would run all tests - excluding those that ends with IntTest
> The amount of code needed for implementation is minimal. In SurefirePlugin.java:
> Just add a property - something like:
>     /**
>      * Specify this parameter to exclude test by their name. It follows
>      * the same conventions as the <code>test</code> parameter.
>      * 
>      * @parameter expression="${exclude}"
>      * 
>      */
>     private String exclude;
> Add this code at line 527
>                 if ( this.exclude != null )
>                 {   
>                     String exclude = "**/" + this.exclude + ".java";
>                     excludes.add(exclude);
>                     getLog().debug( "Excluding test with pattern :" + exclude );
>                 }
> ...and that's all.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Updated: (SUREFIRE-131) Excluding tests with command line pattern

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brett Porter updated SUREFIRE-131:
----------------------------------

    Fix Version/s:     (was: 2.3)
                   2.4

> Excluding tests with command line pattern
> -----------------------------------------
>
>                 Key: SUREFIRE-131
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-131
>             Project: Maven Surefire
>          Issue Type: New Feature
>    Affects Versions: 2.0 (2.2 plugin)
>         Environment: All environments running JUnit tests
>            Reporter: Johannes Carlén
>             Fix For: 2.4
>
>
> I'd like to be able to exclude certain tests from being run. An example of this could be a scenario where I'd like just the unit tests and not the integration tests to run. In our case, we name all integration test with the postfix "IntTest" instead of just "Test".
> This is now possible through configuring the plugin in the pom, however it is not possible to decide at the command line if I just like to run some tests and not all.
> Example of use with this implementation would be:
> mvn -Dexclude=*IntTest test
> which would run all tests - excluding those that ends with IntTest
> The amount of code needed for implementation is minimal. In SurefirePlugin.java:
> Just add a property - something like:
>     /**
>      * Specify this parameter to exclude test by their name. It follows
>      * the same conventions as the <code>test</code> parameter.
>      * 
>      * @parameter expression="${exclude}"
>      * 
>      */
>     private String exclude;
> Add this code at line 527
>                 if ( this.exclude != null )
>                 {   
>                     String exclude = "**/" + this.exclude + ".java";
>                     excludes.add(exclude);
>                     getLog().debug( "Excluding test with pattern :" + exclude );
>                 }
> ...and that's all.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] (SUREFIRE-131) Excluding tests with command line pattern

Posted by "Shane Witbeck (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/SUREFIRE-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=311995#comment-311995 ] 

Shane Witbeck commented on SUREFIRE-131:
----------------------------------------

I'm voting this up because there doesn't seem to be a way to include/exclude TestNG test groups other than through path patterns like what's suggested here.

See: http://stackoverflow.com/questions/7150302/excluding-testng-groups-from-maven
                
> Excluding tests with command line pattern
> -----------------------------------------
>
>                 Key: SUREFIRE-131
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-131
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.0 (2.2 plugin)
>         Environment: All environments running JUnit tests
>            Reporter: Johannes Carlén
>            Priority: Minor
>             Fix For: Backlog
>
>
> I'd like to be able to exclude certain tests from being run. An example of this could be a scenario where I'd like just the unit tests and not the integration tests to run. In our case, we name all integration test with the postfix "IntTest" instead of just "Test".
> This is now possible through configuring the plugin in the pom, however it is not possible to decide at the command line if I just like to run some tests and not all.
> Example of use with this implementation would be:
> mvn -Dexclude=*IntTest test
> which would run all tests - excluding those that ends with IntTest
> The amount of code needed for implementation is minimal. In SurefirePlugin.java:
> Just add a property - something like:
>     /**
>      * Specify this parameter to exclude test by their name. It follows
>      * the same conventions as the <code>test</code> parameter.
>      * 
>      * @parameter expression="${exclude}"
>      * 
>      */
>     private String exclude;
> Add this code at line 527
>                 if ( this.exclude != null )
>                 {   
>                     String exclude = "**/" + this.exclude + ".java";
>                     excludes.add(exclude);
>                     getLog().debug( "Excluding test with pattern :" + exclude );
>                 }
> ...and that's all.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Updated: (MSUREFIRE-135) Excluding tests with command line pattern

Posted by "fabrizio giustina (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MSUREFIRE-135?page=all ]

fabrizio giustina updated MSUREFIRE-135:
----------------------------------------

    Fix Version/s: 2.3

> Excluding tests with command line pattern
> -----------------------------------------
>
>                 Key: MSUREFIRE-135
>                 URL: http://jira.codehaus.org/browse/MSUREFIRE-135
>             Project: Maven 2.x Surefire Plugin
>          Issue Type: New Feature
>    Affects Versions: 2.2
>         Environment: All environments running JUnit tests
>            Reporter: Johannes Carlén
>             Fix For: 2.3
>
>
> I'd like to be able to exclude certain tests from being run. An example of this could be a scenario where I'd like just the unit tests and not the integration tests to run. In our case, we name all integration test with the postfix "IntTest" instead of just "Test".
> This is now possible through configuring the plugin in the pom, however it is not possible to decide at the command line if I just like to run some tests and not all.
> Example of use with this implementation would be:
> mvn -Dexclude=*IntTest test
> which would run all tests - excluding those that ends with IntTest
> The amount of code needed for implementation is minimal. In SurefirePlugin.java:
> Just add a property - something like:
>     /**
>      * Specify this parameter to exclude test by their name. It follows
>      * the same conventions as the <code>test</code> parameter.
>      * 
>      * @parameter expression="${exclude}"
>      * 
>      */
>     private String exclude;
> Add this code at line 527
>                 if ( this.exclude != null )
>                 {   
>                     String exclude = "**/" + this.exclude + ".java";
>                     excludes.add(exclude);
>                     getLog().debug( "Excluding test with pattern :" + exclude );
>                 }
> ...and that's all.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Updated: (SUREFIRE-131) Excluding tests with command line pattern

Posted by "Dan Fabulich (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Fabulich updated SUREFIRE-131:
----------------------------------

         Priority: Minor  (was: Major)
    Fix Version/s:     (was: 2.4)
                   2.x

I hesitate to add another option to a plugin that already has so many options, especially one that sounds so much like another option we already have.

Note that this is not the recommended way to address the division between unit tests and integration tests.  The recommended way is to put your unit tests into a separate module, or at least a separate plugin execution.  http://docs.codehaus.org/display/MAVENUSER/Maven+and+Integration+Testing

Finally, it's already possible to put <excludes><exclude>${mySpecialProperty}</exclude></excludes> in your plugin configuration, allowing you to configure your plugin from the command line.

> Excluding tests with command line pattern
> -----------------------------------------
>
>                 Key: SUREFIRE-131
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-131
>             Project: Maven Surefire
>          Issue Type: New Feature
>    Affects Versions: 2.0 (2.2 plugin)
>         Environment: All environments running JUnit tests
>            Reporter: Johannes Carlén
>            Priority: Minor
>             Fix For: 2.x
>
>
> I'd like to be able to exclude certain tests from being run. An example of this could be a scenario where I'd like just the unit tests and not the integration tests to run. In our case, we name all integration test with the postfix "IntTest" instead of just "Test".
> This is now possible through configuring the plugin in the pom, however it is not possible to decide at the command line if I just like to run some tests and not all.
> Example of use with this implementation would be:
> mvn -Dexclude=*IntTest test
> which would run all tests - excluding those that ends with IntTest
> The amount of code needed for implementation is minimal. In SurefirePlugin.java:
> Just add a property - something like:
>     /**
>      * Specify this parameter to exclude test by their name. It follows
>      * the same conventions as the <code>test</code> parameter.
>      * 
>      * @parameter expression="${exclude}"
>      * 
>      */
>     private String exclude;
> Add this code at line 527
>                 if ( this.exclude != null )
>                 {   
>                     String exclude = "**/" + this.exclude + ".java";
>                     excludes.add(exclude);
>                     getLog().debug( "Excluding test with pattern :" + exclude );
>                 }
> ...and that's all.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Commented: (SUREFIRE-131) Excluding tests with command line pattern

Posted by "ian pojman (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=180881#action_180881 ] 

ian pojman commented on SUREFIRE-131:
-------------------------------------

Actually, something like this would be useful if you want to run all tests except for one which is known to fail, similar to -Dtest, a

 -DexcludeTest=A*,B*,C

> Excluding tests with command line pattern
> -----------------------------------------
>
>                 Key: SUREFIRE-131
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-131
>             Project: Maven Surefire
>          Issue Type: New Feature
>    Affects Versions: 2.0 (2.2 plugin)
>         Environment: All environments running JUnit tests
>            Reporter: Johannes Carlén
>            Priority: Minor
>             Fix For: 2.x
>
>
> I'd like to be able to exclude certain tests from being run. An example of this could be a scenario where I'd like just the unit tests and not the integration tests to run. In our case, we name all integration test with the postfix "IntTest" instead of just "Test".
> This is now possible through configuring the plugin in the pom, however it is not possible to decide at the command line if I just like to run some tests and not all.
> Example of use with this implementation would be:
> mvn -Dexclude=*IntTest test
> which would run all tests - excluding those that ends with IntTest
> The amount of code needed for implementation is minimal. In SurefirePlugin.java:
> Just add a property - something like:
>     /**
>      * Specify this parameter to exclude test by their name. It follows
>      * the same conventions as the <code>test</code> parameter.
>      * 
>      * @parameter expression="${exclude}"
>      * 
>      */
>     private String exclude;
> Add this code at line 527
>                 if ( this.exclude != null )
>                 {   
>                     String exclude = "**/" + this.exclude + ".java";
>                     excludes.add(exclude);
>                     getLog().debug( "Excluding test with pattern :" + exclude );
>                 }
> ...and that's all.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Updated: (SUREFIRE-131) Excluding tests with command line pattern

Posted by "Kristian Rosenvold (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Rosenvold updated SUREFIRE-131:
----------------------------------------

    Component/s: Maven Surefire Plugin

> Excluding tests with command line pattern
> -----------------------------------------
>
>                 Key: SUREFIRE-131
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-131
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.0 (2.2 plugin)
>         Environment: All environments running JUnit tests
>            Reporter: Johannes Carlén
>            Priority: Minor
>             Fix For: Backlog
>
>
> I'd like to be able to exclude certain tests from being run. An example of this could be a scenario where I'd like just the unit tests and not the integration tests to run. In our case, we name all integration test with the postfix "IntTest" instead of just "Test".
> This is now possible through configuring the plugin in the pom, however it is not possible to decide at the command line if I just like to run some tests and not all.
> Example of use with this implementation would be:
> mvn -Dexclude=*IntTest test
> which would run all tests - excluding those that ends with IntTest
> The amount of code needed for implementation is minimal. In SurefirePlugin.java:
> Just add a property - something like:
>     /**
>      * Specify this parameter to exclude test by their name. It follows
>      * the same conventions as the <code>test</code> parameter.
>      * 
>      * @parameter expression="${exclude}"
>      * 
>      */
>     private String exclude;
> Add this code at line 527
>                 if ( this.exclude != null )
>                 {   
>                     String exclude = "**/" + this.exclude + ".java";
>                     excludes.add(exclude);
>                     getLog().debug( "Excluding test with pattern :" + exclude );
>                 }
> ...and that's all.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira