Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Had the same problem as you. Zero results in TestNG reports but looks like tests were runned. Finally get this work on two separate executions of <code>maven-surefire-plugin</code> </p> <ol> <li>First remove the <code>dependencies</code> section from plugin. <ul> <li>otherwise if you use <code>&lt;testNGArtifactName&gt;</code> (and we'll need it) tests will be executed by TestNG anyway and will fail on <code>java.lang.NullPointerException</code></li> </ul></li> <li>Have some separation of TestNG tests and JUnit tests. In our case NG test class names ends with <code>TestNg</code></li> <li>skip default execution</li> <li>define two <code>&lt;executions&gt;</code> like below: </li> </ol> <pre class="lang-xml prettyprint-override"><code>&lt;plugin&gt; &lt;!-- configured to work with JUnit and TestNg in same project separatelly --&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt; &lt;configuration&gt; &lt;!-- whatever you need... --&gt; &lt;!-- skip the default execution, we have separate for Ng and for JUnit --&gt; &lt;skip&gt;true&lt;/skip&gt; &lt;/configuration&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;TestNg-execution&lt;/id&gt; &lt;phase&gt;test&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;test&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;!-- overwrite skip from default config --&gt; &lt;skip&gt;false&lt;/skip&gt; &lt;includes&gt; &lt;include&gt;%regex[.*TestNg.*]&lt;/include&gt; &lt;/includes&gt; &lt;!-- used to skip JUnit profider --&gt; &lt;junitArtifactName&gt;dev:null&lt;/junitArtifactName&gt; &lt;!-- to continue on next execution in case of failures here --&gt; &lt;testFailureIgnore&gt;true&lt;/testFailureIgnore&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;JUnit-execution&lt;/id&gt; &lt;phase&gt;test&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;test&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;skip&gt;false&lt;/skip&gt; &lt;!-- used to skip TestNg profider --&gt; &lt;testNGArtifactName&gt;dev:null&lt;/testNGArtifactName&gt; &lt;excludes&gt; &lt;exclude&gt;%regex[.*TestNg.*]&lt;/exclude&gt; &lt;/excludes&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; </code></pre> <p>Tested with:</p> <pre class="lang-xml prettyprint-override"><code>&lt;junit-version&gt;4.11&lt;/junit-version&gt; &lt;maven-surefire-plugin-version&gt;2.16&lt;/maven-surefire-plugin-version&gt; &lt;org.testng-version&gt;6.8.7&lt;/org.testng-version&gt; </code></pre> <p>This configuration is the marge of ideas from:<br> <a href="http://rolf-engelhard.de/2011/07/running-testng-junit3-and-junit4-tests-with-maven-surefire-in-one-run/" rel="nofollow">Running TestNG-, JUnit3- and JUnit4-tests with Maven Surefire in one run</a>,<br> <a href="https://jira.codehaus.org/browse/SUREFIRE-1019" rel="nofollow">your SUREFIRE bug report</a>,<br> <a href="http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html" rel="nofollow">surefire plugin configuration</a> </p> <p>Hope it helps.</p>
    singulars
    1. This table or related slice is empty.
    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.
    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