You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Baz <ba...@gmail.com> on 2007/04/05 02:04:22 UTC
How can i run the junit in Maven 2.0?
All,
I have developers *Test.java files in place and invoking some sort of
junit frameworks.
My question is: Do i need to invoke anything to run the Junit?
Surefire? How? If i add the surefire plugins in pom.xml, is that mean
the junits will be executed?
How can i tell surefire to output in xml format?
Thanks.
B.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How can i run the junit in Maven 2.0?
Posted by franz see <fr...@gmail.com>.
Good day to you, B.,
Maven goes through different build phases. One of them is test. In this test
phase, the goal surefire:test is invoked ( See [1] for more info on
lifecycles and phases). This will run your test cases ( which are your java
files which has the following pattern: Test*.java, *Test.java,
*TestCase.java. See [2] for more info ) in your test directory ( which by
default is src/test/java. See [3] for more info ). Thus, as long as you have
src/test/java/**/Test*.java or src/test/java/**/*Test.java or
src/test/java/**/*TestCase.java, and you invoke a command which goes pass
the test phase ( mvn package, mvn install, mvn deploy, etc ), your tests
would run even if you don't configure anything in your pom ( except for
adding junit to your dependency :) ).
After running the commands, you can take a look at your
target/surefire-reports/ and you will see text and xml files for each of
your test case. That's because for each of your test case, the
maven-surefire-report-plugin will generate a text and an xml output.
Also, if you want to generate surefire reports you can also take a look at
[4] for the maven-surefire-report-plugin.
Cheers,
Franz
[1] http://docs.codehaus.org/display/MAVENUSER/introduction-to-the-lifecycle
[2]
http://maven.apache.org/plugins/maven-surefire-plugin/examples/inclusion-exclusion.html
[3]
http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
[4] http://maven.apache.org/plugins/maven-surefire-report-plugin/
Baz-6 wrote:
>
> All,
>
> I have developers *Test.java files in place and invoking some sort of
> junit frameworks.
>
> My question is: Do i need to invoke anything to run the Junit?
> Surefire? How? If i add the surefire plugins in pom.xml, is that mean
> the junits will be executed?
>
> How can i tell surefire to output in xml format?
>
> Thanks.
>
> B.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/How-can-i-run-the-junit-in-Maven-2.0--tf3528942s177.html#a9848728
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org