java - Using JunitCore for tests in different projects -


background:

i working on project in eclipse programatically executes junit tests pushed server.

so far works know results of tests (specifically failures) can push them out email. right tests output console doesn't seem give me output use.

right use runtime class call tests doesn't seem have functionality need getting results. have looked junitcore class can't call tests outside of current java project.


so main question how can use junitcore run junit tests in specific jar file? or there easier way approach problem using different class?

this thing i've been able work:

runtests()     {         junitcore = new junitcore();          junitcore.run(alltests.class);     } 

but along lines of this:

runtests()     {         junitcore = new junitcore();          junitcore.run("c:\\$batch\\test\\hil research\\201507071307\\commstestrunner\\plugins\\testsuite\\us35644.class");     } 

i appreciate suggestions problem having. i'm ee , introduced java last month has been quite challenge me.

junitcore expects read loaded classes, not class files in jar. real question how load jar (or directory of .class files) can run.

poke around urlclassloader; once you've amended classpath appropriately, can class out of findclass , pass junitcore methods you've found.


Comments