我有但我不知道它是怎麼開始執行,因爲它不包含主或任何亞軍類功能這工作絕對沒問題的樣本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