我有但我不知道它是怎么开始执行,因为它不包含主或任何亚军类功能这工作绝对没问题的样本JUnit
测试用例“主”的功能。任何人都可以分享如何执行JUnit
测试用例没有主要功能?哪里调用的JUnit测试案例
的代码是:
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
public void test() {
int a = 1;
assertEquals("Testing...", 1, a);
}
@Ignore
@Test
public void test1() {
int a = 156;
assertEquals("Testing...", 156, a);
}
}
谢谢@Matthew :) – Amrit