Maven Surefire Plugin: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 46: Line 46:
* Single Test Example: http://maven.apache.org/plugins/maven-surefire-plugin/examples/single-test.html
* Single Test Example: http://maven.apache.org/plugins/maven-surefire-plugin/examples/single-test.html


<pre>
mvn -Dtest=TestCircle test
mvn -Dtest=TestCircle test
</pre>


Works for both JUnit and TestNG.
Works for both JUnit and TestNG.
==Do Not Run Tests==
mvn -Dmaven.test.skip=true ...

Revision as of 19:29, 20 August 2019

External

Internal

Configuration Example

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.19.1</version>
    <configuration>
        <systemProperties>
            <property>
                <name>basedir</name>
                <value>${basedir}</value>
            </property>
        </systemProperties>
   </configuration>
</plugin>

Also see Passing system properties to Gradle Tests.

Attaching the Plugin to a Specific Phase

Plugin Execution

Procedures

Debugging Tests

mvn -Dmaven.surefire.debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" test

Running Individual Tests

mvn -Dtest=TestCircle test

Works for both JUnit and TestNG.

Do Not Run Tests

mvn -Dmaven.test.skip=true ...