Thursday, 24 February 2011

Maven Surefire executing only one test method in a test class

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

Wednesday, 2 February 2011

Sonar Instance @ASF

A Sonar instance is now available at ASF http://analysis.apache.org/.

Builds are provided by Jenkins : http://analysis.apache.org/jenkins/ (yes I couldn't resist to use it even before the first official release :-) ).

If you want to add your project see : http://wiki.apache.org/general/SonarInstance

Have Fun and Thanks ASF INFRA !