Export JUnit Test Application in Eclipse 3.1
1 posts in topic
Flat View  Flat View

Posted By:   Dust_Worm
Posted On:   Monday, October 3, 2005 08:30 PM

I was wondering if it is possible to do the following.
I have a simple application that is tested by JUnit.
Now, what I would like to do is to create a JAR file that would run the test. Meaning, myApp.jar, click, and runs the test on myApp.


Re: Export JUnit Test Application in Eclipse 3.1

Posted By:   Christopher_Koenigsberg  
Posted On:   Saturday, October 8, 2005 12:07 PM

just write a static "main" method that runs the tests, and specify that as the entry point for executing the jar, in the META-INF.

Assuming you've written the static "main" method in one of your classes, when you do "Export as Jar" on your Java project, Eclipse will even prompt you if you want a specific class's "main" method to be designated in the META-INF, and will even let you bring up a list of all the classes it finds that have "main" methods, so you can pick one.

At least, IBM Websphere Studio Application Developer does this, and is based on Eclipse 2.X, and I think this is part of the basic Eclipse platform, not something that IBM's added.

Also if you do "New", "JUnit" .... the wizard even asks you if it should auto-generate a static "main" method, in your test runner class.
About | Sitemap | Contact