我是新手Java & JUnit
,遇到了不同的灯具.我在网上搜索了很多,但我找不到答案.
是否可以@Before @After
针对不同的测试用例使用不同的JUnit
?例如:我有以下TC,那么可以使用不同@Before
的测试和不同@Before
的test1
import static org.junit.Assert.assertEquals;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
public class testJUnit {
@BeforeClass
public static void setUpBeforeClass() throws Exception {
System.out.println("Before Class");
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
System.out.println("Tear Down After Class");
}
@Before
public void setUp() throws Exception {
System.out.println("Setup");
}
@After
public void tearDown() throws Exception {
System.out.println("Tear Down");
}
@Test …
Run Code Online (Sandbox Code Playgroud)