This works (http://junit.sourceforge.net/doc/faq/faq.htm#organize_3),
thank you.

But it doesn't work exactly like I originally wanted it.

I wrote a TestCase (lets call it CompanyTestCase) which I extend from
the original JUnit TestCase class.

I would like that the subclasses of CompanyTestCase only need to
override the methods oneTimeSetUp() and oneTimeTearDown().
But I didn't figure it out how to do it since its a mix of static and
non static things.

The other code should be in the upper class, CompanyTestCase, instead
of pasting it in all subclasses:

public static Test suite() {

    TestSuite suite = new TestSuite();

    suite.addTest(SomeTest.suite());
    suite.addTest(AnotherTest.suite());

    TestSetup wrapper = new TestSetup(suite) {

        protected void setUp() {
            oneTimeSetUp();
        }

        protected void tearDown() {
            oneTimeTearDown();
        }
    };

    return wrapper;
}

Is there a solution for what I want to achieve?







Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=315388.5526708.6599542.3001176/D=groups/S=:HM/A=2372354/rand=616698720


Yahoo! Groups Links

Reply via email to