최근에는 test가 개발의 화두임.

TDD(Test Driven Development)

Main을 이용한 테스트는 이제 안녕.

생성 방법은 new -> Junit Test Case(setup() 체크)

Run 할때는 그냥 하거나 메소드 이름을 드래그(더블 클릭)하고 run as ->Junit Test



import static org.junit.Assert.*;


import org.junit.Before;

import org.junit.Test;


public class TimeTest {


timeDAO dao;

@Before

public void setUp() throws Exception {

dao = new TimeDAOImpl();

}


@Test

public void test() {

// fail("Not yet implemented");

int v = 10;

assertEquals(v, 10);

}


@Test

public void test2() throws Exception {

assertNotNull(dao.getTime());

}

}

Posted by 타다키치
,