Hi, all, I got a question on the addTest method of TestSuite class. I wrote a TestSuite class with the static suite method like this:
public static
Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(CalTest.class);
return suite;
}
where CalTest is a class inheriting from TestCase class. This part of code is ok. However if I change to this
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new CalTest()); --- difference
return suite;
}
The launch of the testrunner fails and reports a AssertionFailedError. On the
JUnit api
doc, the addTest(Test test) method does not have any explanation. I would like to know what is wrong with the second method.