1.在pop.xml中添加Junit,Context,tset依赖。

2.编写待测程序Max类

3.在beans.xml传值

4.新建MaxTest类

5.编写MaxTest类并运行

注:@RunWith:让测试运行于Spring测试环境
@ContextConfiguration Spring整合JUnit4测试时,使用注解引入多个配置文件
@Autowired自动注入配置文件中的bean
注:@RunWith:让测试运行于Spring测试环境
@ContextConfiguration Spring整合JUnit4测试时,使用注解引入多个配置文件
@Autowired自动注入配置文件中的bean
本文标题:09-JUnit单元测试
本文链接:https://www.haomeiwen.com/subject/nopwuqtx.html
网友评论