|Re: Exclude junit test from runnable jar [message #1722133 is a reply to message #1722128]
||Tue, 02 February 2016 22:53
| Russell Bateman
Registered: July 2009
Location: Provo, Utah, USA
On 02/02/2016 03:04 PM, Peter Ream wrote:|
> This has been beaten to death, but I still can't make it work. I have
> read and re-read https://www.eclipse.org/forums/index.php/t/198085/ from
> sometime ago. It makes sense, but I can't get it to work. I am an
> eclipse and java noob. I think I have my setup correct. I have all my
> testing classes in a test source folder. If I export as "jar file", I
> have the opportunity to exclude my junit tests. However to export as
> "runnable jar file" I am no longer afforded this exclusion. When I
> export, I get "JAR export finished with warnings. See details for
> additional information.
> Exported with compile warnings:
> DigitToWords/test/org/digitstowords/DigitsToWordsTest.java." I have
> tried setting up my own runnable manifest to no avail. This can't be
> this difficult or I am an idiot.
Not really an Eclipse question here, but does it help if I say this?
To run from the command line a JUnit test you've created, you need a
main() method to call it in your runnable JAR, which you create just as
you would any other runnable JAR.
Create your JUnit test class as normal, here, FunTest, create another
class with a public static void main( String args ) inside that calls
public class RunnableFunTest
public static void main( String args )
TestRunner.run( FunTest.class );
Obviously, when you run this from the command line, you'll also have to
make allowances for the JUnit JAR (library) to be present whether you
bundled it as a stand-alone or have junit.jar on your classpath.
Powered by FUDForum
. Page generated in 0.03654 seconds