I wo开发者_JS百科uld like to run 2 tests methods using eclipse. I can run 1 test, and whole test class, but 2 test method is impossible.
Any idea how I can do this?
write a test suite which includes your tests, like
public static Test suite(){
TestSuite suite = new TestSuite();
suite.addTest(new BookTest("testEquals"));
suite.addTest(new BookTest("testBookAdd"));
return suite;
}
and run this suite instead of the single tests. See this tutorial for more information.
If you want to use JUnit4 syntax then try
@RunWith(Suite.class)
@Suite.SuiteClasses({
JunitTest1.class,
JunitTest2.class
})
You can also select your test source directory or a package and right-click it and select "Run As -> Junit Test" to execute all tests in that source directory or package.
Mark as comment the test methods you don't like to run. Run the class as J-Unit test.
精彩评论