공통컴포넌트의 junit
- 작성자 :
- 이*하
- 작성일 :
- 2011-06-13 15:29:15
- 조회수 :
- 2,507
- 구분 :
- 공통컴포넌트
- 진행상태 :
- 완료
Q
egov 프레임워크의 공통컴포넌트를 이용해서 프로젝트를 진행하고 있습니다.
이곳에서 많은 정보와 도움을 받고 있어 감사합니다.
junit으로 controller 단을 테스트하고 싶은데
테스트 클래스에
@ContextConfiguration(locations = {
"classpath:egovframework/spring/context-aspect.xml"
, "classpath:egovframework/spring/context-common.xml"
, "classpath:egovframework/spring/context-datasource.xml"
, "classpath:egovframework/spring/context-excel.xml"
, "classpath:egovframework/spring/context-idgen.xml"
, "classpath:egovframework/spring/context-properties.xml"
, "classpath:egovframework/spring/context-security.xml"
, "classpath:egovframework/spring/context-transaction.xml"
, "classpath:egovframework/spring/context-validator.xml"
, "/WEB-INF/config/egovframework/springmvc/egov-com-*.xml"
})
로 선언하였는데 정상적으로 동작하지않습니다.
web.xml에
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:egovframework/spring/context-*.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/config/egovframework/springmvc/egov-com-*.xml
</param-value>
</init-param>
로 선언되어있던데
@ContextConfiguration(locations = {
"classpath*:egovframework/spring/context-*.xml"
, "/WEB-INF/config/egovframework/springmvc/egov-com-*.xml"
})
위와같이 설정도 해보았는데 저것도 안되는거같습니다.
application context를 어떤거를 설정해야하는요.
그리고 공통컴포넌트에서 junit을 사용한 예제 소스 코드가 있으면
부탁드리겠습니다.
이곳에서 많은 정보와 도움을 받고 있어 감사합니다.
junit으로 controller 단을 테스트하고 싶은데
테스트 클래스에
@ContextConfiguration(locations = {
"classpath:egovframework/spring/context-aspect.xml"
, "classpath:egovframework/spring/context-common.xml"
, "classpath:egovframework/spring/context-datasource.xml"
, "classpath:egovframework/spring/context-excel.xml"
, "classpath:egovframework/spring/context-idgen.xml"
, "classpath:egovframework/spring/context-properties.xml"
, "classpath:egovframework/spring/context-security.xml"
, "classpath:egovframework/spring/context-transaction.xml"
, "classpath:egovframework/spring/context-validator.xml"
, "/WEB-INF/config/egovframework/springmvc/egov-com-*.xml"
})
로 선언하였는데 정상적으로 동작하지않습니다.
web.xml에
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:egovframework/spring/context-*.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/config/egovframework/springmvc/egov-com-*.xml
</param-value>
</init-param>
로 선언되어있던데
@ContextConfiguration(locations = {
"classpath*:egovframework/spring/context-*.xml"
, "/WEB-INF/config/egovframework/springmvc/egov-com-*.xml"
})
위와같이 설정도 해보았는데 저것도 안되는거같습니다.
application context를 어떤거를 설정해야하는요.
그리고 공통컴포넌트에서 junit을 사용한 예제 소스 코드가 있으면
부탁드리겠습니다.
A
안녕하세요.. 이동하님..
우선.. @ContextConfiguration 설정 상에 "*"와 같은 ant-style 패턴이 적용되지 않기 때문에 오류가 발생하신 것 같습니다.
"/WEB-INF/config/egovframework/springmvc/egov-com-*.xml"
이 부분을 위에처럼 실제 파일명으로 변경해 주시면 되실 것 같습니다.
혹.. 개별 파일로 지정하셔도 오류가 발생하면..
해당 파일들은 src/test/resources로 옮기시고..
앞에 "classpath:" prefix를 통해 호출해 보시기 바랍니다.
추가로.. 공통컴포넌트 부분은 별도로 JUnit 케이스가 만들어지지 않았습니다.
(UI 및 DB 처리가 포함되어 있어서.. 전문가에 의한 수동테스트가 수행되었습니다.)
그럼.. 즐거운 하루되십시오.
감사합니다.
우선.. @ContextConfiguration 설정 상에 "*"와 같은 ant-style 패턴이 적용되지 않기 때문에 오류가 발생하신 것 같습니다.
"/WEB-INF/config/egovframework/springmvc/egov-com-*.xml"
이 부분을 위에처럼 실제 파일명으로 변경해 주시면 되실 것 같습니다.
혹.. 개별 파일로 지정하셔도 오류가 발생하면..
해당 파일들은 src/test/resources로 옮기시고..
앞에 "classpath:" prefix를 통해 호출해 보시기 바랍니다.
추가로.. 공통컴포넌트 부분은 별도로 JUnit 케이스가 만들어지지 않았습니다.
(UI 및 DB 처리가 포함되어 있어서.. 전문가에 의한 수동테스트가 수행되었습니다.)
그럼.. 즐거운 하루되십시오.
감사합니다.