[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) {
}
}
}
이 글과 관련된 글
- [2012/01/13] Private Video Sharing Service 'Givit' (511)
- [2011/09/15] 24 Usability Testing Tools (1557)
- [2011/09/07] Online Free Documentary Website (Documentary Heaven) (1973)
- [2011/07/26] 스프링에서 한글 깨지는 문제 (2155)
- [2011/05/30] Eclipse 인코딩 설정하기 (1382)
- Tag :
- tdd , video , testing , java , agile , tutorial , programming , development , junit , eclipse
