8.1. Introduction

개발자 테스트(developer testing)은 소프트웨어 개발의 중요한 요소입니다.
IoC가 테스팅에 가져다 주는 이점과 Spring 프레임워크가 integration Testing에 가져다 주는 이점을 살펴 보겠습니다.

8.2. Unit testing

DI를 사용할 때의 장점은 이전 보다 컨테이너에 종속성이 훨씬 줄어들었다는 것입니다.
POJO를 테스트 하기 위해서는 어떤 컨테이너나 Spring이 필요 없습니다.
다른 객체와 연관되어 있을 경우 mock 객체를 사용하여 단위 테스트를 할 수 있습니다.
단위 테스트는 서버 설정, DB 설정 등의 환경 설정이 필요 없기 때문에 매우 빨리 할 수 있으며 생산성을 높여 줍니다.

8.3. Integration testing

하지만 어플리케이션 서버에 배포하거나 다른 infra와 통합하지 않은 상태에서 다음의 것들을 테스트할 수 있어야 합니다.

  • The correct wiring of your Spring IoC container contexts.

  • Data access using JDBC or an ORM tool. This would include
    such things such as the correctness of SQL statements / or Hibernate
    XML mapping files

They will be slower
to run than unit tests, but much faster to run than the equivalent Cactus
tests or remote tests relying on deployment to an application server.

8.3. Integration testing

8.4. Further Resources