@Before 메서드에서 현재 실행중인 TestCase 메서드의 이름을 가져 오려고합니다. 예JUNIT에서 @Before에서 현재 실행중인 @Test 메서드의 이름을 가져옵니다.
public class SampleTest()
{
@Before
public void setUp()
{
//get name of method here
}
@Test
public void exampleTest()
{
//Some code here.
}
}
http://stackoverflow.com/questions/473401/get-name-of-curren junit-4에서 테스트 실행 중입니까? – ivarni
테스트 클래스에'previousName' 필드를 추가하고 각 테스트 메소드의 끝에 값을 설정합니다. – TecHunter