I have class runner for all my tests:
import org.junit.*;
import org.junit.rules.TestName;
import org.junit.rules.TestRule;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
import org.junit.runner.Result;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;
@RunWith(Suite.class)
@Suite.SuiteClasses({
Test1.class,
Test2.class,
Test3.class,
Test4.class,
Test5.class
})
public class AllTestRunner {
...
@Before
public void method1() {}
@After
public void method2() {}
I need to run method1()
and method2()
for each @Test
in each class from SuiteClasses
.
But it doesn't work, may be I do smth. wrong?
Thanks for your help and sorry for my english.