[TDD] Video tutorial: Test Driven Development in practice 개발이야기
2010.07.07 10:07 Edit
eclipse, junit를 통해 계산기를 tdd 개발하는 과정을 보여주는 스크린케스트입니다.
tdd의 기초를 다질 때 보면 좋을것 같습니다.
원문 : http://agilesoftwaredevelopment.com/videos/test-driven-development-basic-tutorial
https://java-code-practice-with-tdd.googlecode.com/svn/trunk/java-code-practice-with-tdd/src/test/java/com/ncrash/calculator/CalculatorTest.java
package com.ncrash.calculator;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
/**
*
* @author daekwon.kang
* @since 2010. 7. 7.
* @see
*/
public class CalculatorTest {
private Calculator calc;
@Before
public void before() {
calc = new Calculatorimpl();
}
@Test
public void testAdd() throws Exception {
assertNotNull("calc is null", calc);
assertEquals(101, calc.add(23, 78));
try {
calc.add(Integer.MAX_VALUE, 100);
fail(OverflowException.class.getName() + " is excepted");
} catch(OverflowException e) {
}
try {
calc.add(Integer.MIN_VALUE, -1);
fail(UnderflowException.class.getName() + " is excepted");
} catch(UnderflowException e) {
}
}
@Test
public void testSub() throws Exception {
assertNotNull("calc is null", calc);
assertEquals(10, calc.sub(20, 10));
try {
calc.sub(Integer.MIN_VALUE, 100);
fail(UnderflowException.class.getName() + " is excepted");
} catch(UnderflowException e) {
}
try {
calc.sub(Integer.MAX_VALUE, -10);
fail(OverflowException.class.getName() + " is excepted");
} catch(OverflowException e) {
}
}
}
이 글과 관련된 글
- [2010/08/21] (번역) 오라클의 안드로이드 소송: 악의 판도라 상자 (338)
- [2010/08/02] [SCJP] SCJP 자격증에 대해 알아보자~! (334)
- [2010/07/17] selenium Browser automation framework (325)
- [2010/07/15] struts2, urlrewrite 설정 (274)
- [2010/07/08] xstream int, null값의 입력 (304)
- Tag :
- tdd , video , testing , java , agile , tutorial , programming , development , junit , eclipse
