Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use Maven Surefire plug-in with different groups for test and integration-test?
    primarykey
    data
    text
    <p>I want to use <strong><a href="http://testng.org/" rel="noreferrer">testng</a></strong> with the <a href="http://maven.apache.org/plugins/maven-surefire-plugin/" rel="noreferrer">Surefire plug-in</a> of <a href="http://en.wikipedia.org/wiki/Apache_Maven" rel="noreferrer">Maven</a>. The idea is to tag some tests with a group <code>integrationTest</code> and run the plug-in twice: for goal <code>test</code> excluding the group <code>integrationTest</code> and for goal <code>integration-test</code> including the group <code>integrationTest</code> only.</p> <p>I found some <a href="http://docs.codehaus.org/pages/viewpage.action?pageId=62120" rel="noreferrer">material</a> for running the plug-in for both goals and that works, but the group for the second run does not work (no test is executed).</p> <p>Here is the plug-in configuration in the build element of my <code>pom.xml</code>:</p> <pre><code> &lt;plugin&gt; &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt; &lt;configuration&gt; &lt;excludedGroups&gt;integrationTest&lt;/excludedGroups&gt; &lt;reportFormat&gt;brief&lt;/reportFormat&gt; &lt;trimStackTrace&gt;true&lt;/trimStackTrace&gt; &lt;useFile&gt;false&lt;/useFile&gt; &lt;/configuration&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;integration-test&lt;/id&gt; &lt;phase&gt;integration-test&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;test&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;groups&gt;integrationTest&lt;/groups&gt; &lt;excludedGroups/&gt; &lt;reportsDirectory&gt;${project.build.directory}/surefire-reports/integration&lt;/reportsDirectory&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; </code></pre> <p>Any idea? <code>mvn integration-test</code> runs all unit tests as expected (excluding the group <code>integrationTest</code>) but the second test run just writes:</p> <blockquote> <p>Running TestSuite<br> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.562 sec</p> </blockquote> <p>The Result of <code>mvn test</code> is as expected, tests run and group <code>integrationTest</code> is ignored.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload