How to pass system properties to maven surefire plugin test run

While developing WSO2 QA test framework (which is based on selenium RC), we wanted to give users the choice of selecting test cases without running whole suite at once. Our plan was to pass a system property during maven test run. However, passing a system property directly through command line does not work since the surefire plugin is run under a different JVM instance that is launched by Maven.
In order to overcome this, maven surefire plugin can be configured as follows by specifying the required system property.


According to this example configuration, we can run test suite with passing a system property as follows.

'mvn clean install -Dtest.suite=test-case'


Henri said…
Another way to do it :

mvn test -Dtest=myTest -DargLine="-Dtest.suite=test-case"
JC said…
This is now deprecated :


Popular posts from this blog

Common mistakes to avoid in WSO2 ESB - 1 - "org.apache.axis2.AxisFault: The system cannot infer the transport information from the URL"

Working with HTTP multipart requests in soapUI

WS-Reliable messaging with WSO2 WSAS -1