java - JUnit test failed to launch -
i doing first junit test project not working.
i did 2 methods 2 test.
my console giving me message " failed launch test" !
how can solve ?
package test; public class junit { public string concentrate (string one, string two) { return 1 + two; } public int multiply (int number1, int number2 ) { return number1*number2; } }
test cases:
package test; import junit.framework.testsuite; import org.junit.runner.runwith; import org.junit.runners.suite; import org.junit.runners.suite.suiteclasses; @runwith(suite.class) @suiteclasses({ concatetest.class, multiplytest.class }) public class alltests extends testsuite { }
multiply test:
package test; import static org.junit.assert.*; import org.junit.test; public class multiplytest { @test public void testmultiply() { junit test = new junit(); int result = test.multiply(3, 4); assertequals(12, result); } }
you have no methods annotated @test
. try add method annotated @test
:
@test public void test(){ assert.asserttrue(multiply(2, 2) == 4); }
cause in actual code test nothing
Comments
Post a Comment