페이지

2021년 7월 2일 금요일

JUnit 4 Annotations

@Test		Identifies a method as a test method.
@Before Executed before each test. It is used to prepare the test environment (e.g. read input data, initialize the class).
@After Executed after test. It is used to cleanup the test environment. It can also save memory by cleaning up expensive memory structures.
@BeforeClass Executed once, before the start of all tests. Methods marked with this annotaion need to be defined as static to work with JUnit.
@AfterClass Executed once, after all tests have been finished. Methods annotated with this annotation need to be defined as static to work with JUnit.
@Ignore Marks that the test should be disabled.
@Test(expected = Fails if the method does not throw the named exception. Exception.class)
@Test(timeout = 10) Fails if the method takes longer than 100 millseconds.

댓글 없음: