Child pages
  • Using Testability Explorer in Maven 2 projects

Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

Explains a temporary solution how to use the Testability Explorer in Maven 2 projects. 


Testability Explorer is an open-source tool that identifies hard-to-test Java code. Right now, you can run the program from the Command Line or using the Ant Task. There is no Maven 2 plugin available at the moment. You have to use the maven-antrun-plugin for the time being. However, there is one big problem. The Testability Explorer JAR files are not available yet in any Maven 2 repository. This page offers a temporary solution for this problem until the JAR files become available in any public Maven 2 repository.

Installing the JAR files to local Maven repo

In order to use the maven-antrun-plugin with the, you have to add two dependencies into your Maven 2 pom.xml under the dependencies section.



As said before, the JAR files are not available in any public repository. You have to add them manually into your local repository. Run the Maven install commands:

mvn install:install-file  -Dfile=[path to]/testability-explorer-1.3.0-r275.jar \ -DartifactId=testability-explorer -Dversion=1.3 \
-Dpackaging=jar -DcreateChecksum=true

mvn install:install-file  -Dfile=[path to]/ant-testability-explorer-1.3.0-r275.jar \ -DartifactId=ant-testability-explorer -Dversion=1.3 \
-Dpackaging=jar -DcreateChecksum=true

You are now ready to use the Testability Explorer in a Maven 2 powered project locally.

Running the Ant Task from Maven

Now that you have the JAR files available locally, you can use the maven-antrun-plugin to run the Testability Explorer during builds. Go to the build section of your pom.xml and add the following plugin (if you do not have a build section in your pom.xml, you have to create <build> and <plugins> first).


                    <id>Testability Explorer</id>
                            <path id="ant.classpath">
                                <path refid="maven.runtime.classpath" />

                            <echo message="Running Testability Explorer" />

                            <property name="" value="target/reports/testability" />
                            <delete dir="${}" />
                            <mkdir dir="${}" />

                            <taskdef name="testability" classname="">
                                <classpath refid="maven.runtime.classpath" />
                            <testability filter="my.package" resultfile="${}/results.xml" print="xml">
                                <classpath refid="maven.runtime.classpath" />

                            <echo message="Done. Reports can be found in ${}/results.xml" />


This will execute the during the test phase of a Maven 2 run, ie. if you run mvn test. Note: in the XML snippet above you have to replace my.package with your own Java package that you want to have tested.


The suggested solution is far from optimal. As the JAR files will become available in a public Maven 2 repository, you will not have to copy them manually into you local repository. Sooner or later, there will also be am official Maven 2 plugin, so that the maven-antrun-plugin will not be required anymore.

  • No labels


  1. Unknown User (

    I noticed making the dependencies <scope>test</scope> did not work. "compile" scope appears to work.

  2. Unknown User (sorokh)

    Well it does work for me however I've had to change the line
    < property name="" value="target/reports/testability" />
    into the following
    < property name="" value="${basedir}/target/reports/testability" />
    This seems to make sure that you use a correct full path. Leaving this out gave me error in the ant task, stating that it could not create the result file.

  3. Unknown User (jimbethancourt)

    Good news! It looks like someone was kind enough to write a report and it works!
    Just add


    to your Maven report plugins section and it works! It's not the prettiest report I've ever seen, but it gets the job done. (smile)