일단 eunit으로 테스트를 하는 것을 가정한다.
unit test - makefile에서...
make file에 다음과 같은 부분을 추가한 후에, make test 하면 간편하게 명령행에서 unit test를 수행할 수있다.
(makefile 뼈대는 Programming Erlang을 기초로 했다.)
unit test, coverage test - 개발중 REPL(distel 또는 erl prompt) 에서...
REPL을 사용해서 (멋지게) 코딩-테스트를 반복중이라면, 다음과 같은 모듈을 하나 디렉토리에 넣어서 test:unit() 또는 test:cover() 를 실행시켜서 unit test 및 coverage test를 시시때때로 수행해 볼 수 있다.
테스트는 아무리 강조해도 지나치지 않다.
경험상 대부분의 버그는 테스트되지 않거나, 적절하지 못한 테스트(셋)들을 통과한 코드에 기생한다.
happy hackin'
unit test - makefile에서...
make file에 다음과 같은 부분을 추가한 후에, make test 하면 간편하게 명령행에서 unit test를 수행할 수있다.
(makefile 뼈대는 Programming Erlang을 기초로 했다.)
......
MODS = doc str_util db i18n tiny_scan
......
test: compile test_subdirs
rm -rf Mnesia.nonode@nohost # removes previous mneisa db (optional).
@for m in ${MODS};\
do \
echo "testing $$m";\
${ERL} -noshell -pz "subdir1" -pz "subdir2" -s $$m test -s init stop;\
done
test_subdirs:
cd subdir1; make test
cd subdir2; make test
MODS = doc str_util db i18n tiny_scan
......
test: compile test_subdirs
rm -rf Mnesia.nonode@nohost # removes previous mneisa db (optional).
@for m in ${MODS};\
do \
echo "testing $$m";\
${ERL} -noshell -pz "subdir1" -pz "subdir2" -s $$m test -s init stop;\
done
test_subdirs:
cd subdir1; make test
cd subdir2; make test
unit test, coverage test - 개발중 REPL(distel 또는 erl prompt) 에서...
REPL을 사용해서 (멋지게) 코딩-테스트를 반복중이라면, 다음과 같은 모듈을 하나 디렉토리에 넣어서 test:unit() 또는 test:cover() 를 실행시켜서 unit test 및 coverage test를 시시때때로 수행해 볼 수 있다.
테스트는 아무리 강조해도 지나치지 않다.
경험상 대부분의 버그는 테스트되지 않거나, 적절하지 못한 테스트(셋)들을 통과한 코드에 기생한다.
happy hackin'