java - How to make a bat file and test with it a JUnit4 Test Suite without Eclipse but with Command Line? -


i finished 2 projects, 1 real one, , other simulates server generates data, , made junit test suite test both , works.

now time send real project tests friend made real server project, generates real data.

so need prepare tests somehow can run them on command line, have no idea how that.

i searched little on net, , there no way run test suite command line...and hope can me.

here have in test project:

tests real project

the class alltests test suite, witch can run tests listed in it:

package test.dss;  import org.junit.runner.runwith; import org.junit.runners.suite; import org.junit.runners.suite.suiteclasses;  @runwith(suite.class) @suiteclasses({     testaddanddeletescript.class,     testenumeratescripts.class,     testenumeratetemplates.class,     testexecute.class,     testgetallimportslist.class,     testgetbindings.class,      testgetsource.class,         testgettemplate.class,     testlogin.class,      testlogout.class,      testopenandclosefile.class,     testreloadlastlog.class,     testsetdates.class,      testsetpatientlist.class,     teststartstoptimer.class,      testupdatebindingparameters.class,     testupdatescript.class,     testupdateshareduserlist.class,     testupdatetextarea.class }) public class alltests {  } 

then there tests other project:

the tests other project

with similar code in alltests class:

package test.mw;  import org.junit.runner.runwith; import org.junit.runners.suite; import org.junit.runners.suite.suiteclasses;  @runwith(suite.class) @suiteclasses({     testenumerateparams.class,       testenumeratepatients.class, // za properties, pogledati red 55     testenumeratescripts.class,     testgetall.class,     testgetresults.class,     testlogin.class,     testlogout.class,     testraisealarm.class,     testregisterunregisterscript.class,     testsaveresult.class }) public class alltests {  } 

now, removed tests workspace, , placed on desktop , have figure out how test in command line, while 2 projects run in elipse on localhost.

on top, wanna create bat file witch friend can run (from command line) , test part (the mw part).

yeah, forgot mention, jars need run tests in jre system library, junit 4 , referenced libraries lib folder.

so, created cmd tests folder on desktop, , copied files tests, , looks this:

test folder on dekstop

so here 2 parts of question: a) how test them @ once 2 test suites? a.b) if there no way, how test each class individually? b) how make bat file run @ once?

please help.

there no need create 2 test suites if want test them together. place of test classes single suite.

but running tests 2 suites somehow this:

java -cp "lib/*;bin" org.junit.runner.junitcore test.dss.alltests test.mv.alltests 

just place .bat file in root of project content , you're ready go.

you can use same command running particular test, means like:

java -cp "lib/*;bin" org.junit.runner.junitcore test.dss.testexecute 

note: don't know how compile classes. guess of them in bin folder. if not add appropriate folder -cp section.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -