/**
* Spring 集成测试基类
* @author LzwGlory
* @version 2013-12-17
*/
import javax.annotation.Resource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;
import com.japdplat.modules.sites.dao.TVideoDao;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext.xml"})
@Transactional
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
@ActiveProfiles("production")
public class Spring_integration_testing {
@Resource
private ApplicationContext ctx;
@Test
public void testSave(){
TVideoDao tvideoDao=ctx.getBean("TVideoDao",TVideoDao.class);
System.out.println(tvideoDao.getAll(1L).size());
}
}
分享到:
相关推荐
自己研制的spring 集成测试类。希望对大家有一定的帮之。我使用的是注解的spring
下载后先建一个数据库,然后在test这个源文件下面去运行
javamelody对cpu等实时监控,项目导入运行可以看见图片等相关信息
如何将Spock模拟注入到Spring集成测试中该项目旨在用作示例指南,以说明如何将Spock与Spring(和Spring Boot)结合使用,并结合使用Spring配置和Spock模拟。 有时,您想使用整个Spring上下文进行更完整的集成测试。 ...
xml的解析文件,jdk1.4以上的要用高版本的xml的解析文件 博文链接:https://zmfkplj.iteye.com/blog/220115
Spring中进行集成测试
主要介绍了Spring Boot 单元测试和集成测试实现详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
介绍这个项目的主要目标是使编写基于PostgreSQL数据库的Spring支持的集成测试变得更加容易。 该库负责根据测试配置为每个测试类或测试方法创建和管理隔离的嵌入式数据库。产品特点支持Spring和Spring Boot框架支持的...
spring集成TestNG与Mockito框架单元测试方法,方便学习者能快速上手如何单测,对自己的代码能够有质量保证。
memcached和spring集成、内附测试例子
NULL 博文链接:https://caerun.iteye.com/blog/1108226
使用Rest Assured和Mockmvc进行Spring mvc集成测试.zip
此文档详细讲解了在spring中如何进行集成测试。
此包主要测试drools5.2与spring整合,drools可调用数据库参数 环境准备,mysql/postgres 用到的表及数据见db.sql 修改hibernate.properties对应的参数 运行测试: com/jview/test/testMapping.java ...
系统监控工具 JavaMelody ,JavaMelody 能够监测Java或Java EE应用程序服务器,并以图表的方式显示:Java内...
spring集成TestNG与Mockito框架单元测试方法
Spring集成quartz跑定时任务实例 自己写的例子并为实现job 有测试的主函数,请参考http://www.blogjava.net/baoyaer/articles/155645.html 博客信息 看此代码,项目里分为两大块,com文件夹下 为上面博客相关学习...