java - How to run JUnit test from command prompt, without a main function -


i want run simple junit test jenkins, , first want try in command prompt, if works.

the junit.jar file in c:\junit.jar

i have dynamic web project, in have "test" package in have logintest class

    package test;     import junit.framework.testcase;     public class logintest extends testcase {          @test         public void testlogin() {             ....             assertstuff...         }     } 

i have separate project testsuite class :

    package test;     import org.junit.extensions.cpsuite.classpathsuite;     import org.junit.runner.runwith;     @runwith(classpathsuite.class)     public class testsuite {      } 

then added logintest class testsuite build path.

if run testsuite junit within eclipse works, want run cmd.

i tried following in cmd :

    java -cp c:\junit.jar;d:\documents\eclipse\blablabla\project_path\bin test.testsuite 

but it's not working. me issue?

read command line carefully:

java -cp c:\junit.jar;... test.testsuite #        (classpath)      (main class) 

you're telling java run testsuite's main method, doesn't exist. compare 1 the question jens linked:

java -cp /usr/share/java/junit.jar org.junit.runner.junitcore [test class name] #        (classpath)               (main class - in junit!)   (first argument) 

rather trying run testsuite, second command asks java run junitcore, has main method java can call. after class name, pass test suite first parameter, tells junitcore load , run class in particular.

try this:

java -cp c:\junit.jar;d:\documents\eclipse\blablabla\project_path\bin org.junit.runner.junitcore test.testsuite #        (your full classpath)                                        (main class)               (your test class) 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -