Junit与spring TestContext框架整合

所需要的包:

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框架整合

上一篇:C++备忘录


下一篇:c/c++全局变量与局部变量