Note that there are some explanatory texts on larger screens.

plurals
  1. POHowto have maven surefire execute JUnit and TestNG test properly?
    text
    copied!<p>Since a while it is possible to configure maven surefire to execute jUnit tests and testNG tests in one build. I won't expand on the reasons why I'm doing that (ok, hint: testNG is our standard framework but some frameworks like <a href="http://jnario.org/" rel="nofollow">jnario</a> require jUnit).</p> <p>The general way to do it is to configure the surefire plugin like this:</p> <pre class="lang-xml prettyprint-override"><code>&lt;plugin&gt; &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt; &lt;version&gt;${surefire.version}&lt;/version&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.apache.maven.surefire&lt;/groupId&gt; &lt;artifactId&gt;surefire-junit47&lt;/artifactId&gt; &lt;version&gt;${surefire.version}&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.apache.maven.surefire&lt;/groupId&gt; &lt;artifactId&gt;surefire-testng&lt;/artifactId&gt; &lt;version&gt;${surefire.version}&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/plugin&gt; </code></pre> <p><a href="http://solidsoft.wordpress.com/2013/03/12/mixing-testng-and-junit-tests-in-one-maven-module-2013-edition/" rel="nofollow">(taken from here)</a></p> <p>This works quite well, jUnit tests and testNG tests get executed.</p> <p>BUT - now I see that testNG tries to execute the jUnit tests too (and maybe vice-versa) - with no success, of course, because it won't see any of its annotations, but it looks like it re-marks the tests to "passed"... anyway, some reporting tools don't show test fails in jUnit tests anymore unless I comment the second dependency entry.</p> <p>Is there any better way to configure surefire so that tests from both frameworks are executed ONLY by their test runners? </p>
 

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