command line execution of junit tests

N

nehal

Hi All,

I have a netbeans project for which junit tests are developed and I
can run the the tests in Netbeans IDE. and I do used the ant to
generate a HTML report.

Anyone can suggest me how to run/execute the tests in the command
line.

Please give me the detailed procedure to run in the command line.

Thank you,
nehal
 
A

Arne Vajhøj

nehal said:
I have a netbeans project for which junit tests are developed and I
can run the the tests in Netbeans IDE. and I do used the ant to
generate a HTML report.

Anyone can suggest me how to run/execute the tests in the command
line.

Please give me the detailed procedure to run in the command line.

JUnit comes with a tool to run command line.

And ant has a junit task (and ant can be run command line).

Arne
 
T

Tom Anderson

Anyone can suggest me how to run/execute the tests in the command line.

In JUnit 4 (which i hope you're using), the class
org.junit.runner.JUnitCore has a main method which runs tests. You simply
name the classes to run as arguments on the command line. For example:

java org.junit.runner.JUnitCore Test1 Test2 Test3

Of course, you need to make sure that JUnit and your test classes - and
any other classes needed by the tests - are on the classpath.

tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top