I have just worked on a improvement in Apache Maven Surefire Plugin.
Most of the time you have a test class which contains a lot of test methods.
When only one failed you have to execute all methods of the class (with -Dtest=MyClass)
This can be long and boring :-).
So now (see [1]), you will be able to use -Dtest=MyClass#myMethod to execute only the method called myMethod from the test class MyClass.
The feature has been pushed in a github fork [2].
Why in a github fork : I'd like to have feedback fast :-)
So how to test it ? :
Get the sources :
git clone git://github.com/olamy/maven-surefire.git
cd maven-surefire
mvn clean install (add -DskipTests if you don't want to execute all integration tests).
Update you pom :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.3-SNAPSHOT</version>
</plugin>
And now test it :-)
-Dtest=MyTestClass#myMethod (note the support of * : -Dtest=MyTestClass#*Method )
NOTE : supported only for junit 4.x
Update : now supported for testng too.
Update 25 Feb : merged in ASF svn repo http://svn.apache.org/viewvc?view=revision&revision=1074633
Update 12 March : released in surefire 2.8 (Yeahhh :-) )
Have Fun ! (and don't miss to put feedback in case of issues)
--
Olivier
[1] http://jira.codehaus.org/browse/SUREFIRE-577
[2] https://github.com/olamy/maven-surefire
2 comments:
In our FlexUnit test framework, a number of test case classes contain tests. While running them using maven, I need to skip certain tests (methods) by providing the test names in a property file.
I'm looking forward to any information towards dynamically enabling and disabling any test’s run when using maven
Is there some way to do this i.e. to exclude few tests and run all other tests of a class.
Any info would be highly appreciated.
Post a Comment