예제 JUnit
테스트 케이스가 있습니다.하지만 정확히 어떻게 작동합니까? 에는 주 또는 모든 러너 클래스 기능이 포함되어 있지 않습니다.. 누구든지 공유 할 수 있습니다 JUnit
테스트 케이스 주 기능없이 실행?JUnit 테스트 케이스에서 'main'함수가 호출 된 곳은 어디입니까
코드는 다음과 같습니다
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