首页 > 编程语言 > 详细

Junit与spring TestContext框架整合

时间:2014-05-15 04:21:26      阅读:399      评论:0      收藏:0      [点我收藏+]

所需要的包:

junit需要是4.5以上

org.springframework.test-XXX.RELEASE.jar

package test;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.works.dao.AosBusinessCoolingDao;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/config/spring/applicationContext.xml"})
public class TestSpringTest extends AbstractJUnit4SpringContextTests {
	@Autowired
	private AosBusinessCoolingDao aosBusinessCoolingDao;

	@Test
	public void show(){
		aosBusinessCoolingDao.findAosBusinessCoolingById(Integer.valueOf(2));
		System.out.println("show");
	}

}


Junit与spring TestContext框架整合,布布扣,bubuko.com

Junit与spring TestContext框架整合

原文:http://blog.csdn.net/zhanyan_x/article/details/25720829

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!