Spring学习笔记之Testing
测试嘛,一般也就两种,一种就是单元测试,另外一个就是集成测试。都是废话
一、单元测试
以前也就是搞个模拟,main函数一写搞定。
现在呢,有了个spring,也有了个推荐规范?这个是个什么东西?什么叫干净的分层,什么叫部件化的代码?
基于IOC的的应用时什么样子的?action里边也需要注入么?
那从哪制造模拟对象呢?org.springframework.mock.env 这个包提供的。
这包到底提供了啥?MockEnvironment 和MockPropertySource ,这些玩意主要就是解决与环境相关属性的
org.springframework.mock.jndi ----------------JNDI
org.springframework.mock.web ----------------Servlet API
org.springframework.mock.web.portlet --------------Portlet API
org.springframework.test.util -------------------General utilities
org.springframework.test.web ----------------------ModelAndViewAssert
二、集成测试
The correct wiring of your Spring IoC container contexts.
- To manage Spring IoC container caching between test execution.
- To provide Dependency Injection of test fixture instances.
- To provide transaction management appropriate to integration testing.
- To supply Spring-specific base classes that assist developers in writing integration tests
浙公网安备 33010602011771号