spring junit 部署两套测试方案
第一套方案:
1、初始化application:使用@ContextConfigurationr的classpath属性,如
@ContextConfiguration(locations =
{ "/META-INF/spring/applicationContext-mutiDs.xml", "/META-INF/spring/applicationContext-timer.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class})
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
@Transactional
public class A
或者
在@Before
public void prepareInit() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath*:META-INF/spring/*.xml");
context.start();
}
第二套方案:
1、使用自己的application.xml和自己的数据
@ContextConfiguration(locations = {"file:src/test/resources/applicationContext.xml",
"file:src/test/resources/dubbo-mdb-provider.xml"})
2、然后把相关的数据库配置放在test目录下面。
3、搞定,两套方案完成。
spring junit 部署两套测试方案的更多相关文章
- Centos7下部署两套python版本并存
Centos7下部署两套python版本并存 需求说明:centos7.2系统的开发机器上已经自带了python2.7版本,但是开发的项目中用的是python3.5版本,为了保证Centos系统的 ...
- Centos7下部署两套python版本并存环境的操作记录
需求说明:centos7.2系统的开发机器上已经自带了python2.7版本,但是开发的项目中用的是python3.5版本,为了保证Centos系统的正常运行,以及节省机器资源(不想因此再申请另外一台 ...
- 独立两套DJANGO+CELERY配置(生产+测试)时要注意的一些细节
1,生产的NGINX环境,要指定自己的目录,而不是PROJ默认的. upstream ism_host { server ; } server { listen ; server_name local ...
- Spring+Junit+Mock测试web项目,即Controller
准备:Maven依赖 <!-- Spring和MVC的包这里不列出来了,webmvc,aspects,orm,其他maven会自动导 --> <dependency> < ...
- spring + junit 测试
spring + junit 测试 需要一个工具类 package com.meizu.fastdfsweb; import org.junit.runner.RunWith; import org. ...
- Openfire 集群部署和负载均衡方案
Openfire 集群部署和负载均衡方案 一. 概述 Openfire是在即时通讯中广泛使用的XMPP协议通讯服务器,本方案采用Openfire的Hazelcast插件进行集群部署,采用Hapro ...
- spring junit
转载自 http://blog.csdn.net/funi16/article/details/8691575 在写单元测试的时候,一般是对数据库进行增删改查的操作,这个时候,如果之前删除了某条记录, ...
- 移动端测试方案--sptt
sptt sptt是移动端UI自动化测试的一种解决方案,全称为special tool of test.sptt提供了一套测试解决方案,并使用命令行完成相关操作,最终可集成在各种后续的流程中. spt ...
- Android MediaCodec硬编兼容性测试方案
作者:阿宝 更新:2016-08-15 来源:彩色世界(https://blog.hz601.org/2016/08/15/android-mediacodec-hardcode-compatibil ...
随机推荐
- http://www.ruanyifeng.com/blog/2013/07/gpg.html
http://www.ruanyifeng.com/blog/2013/07/gpg.html
- 【架构】使用OpenStack、AliYun、AWS、Docker打造融合的IAAS、PAAS平台
GalaxyManager,即平台门户,旨在整合数据中心异构虚拟化资源为统一的资源池,并在资源池上为用户提供各类IAAS.PAAS服务. GitHub:https://github.com/junne ...
- python读取中文
如何从文件中读取300个汉字? 看起来很简单,但很容易掉坑里了. 一开始我这么写: try: fd = codecs.open(os.path.join(settings.TEXT_CONTENT_D ...
- Windows环境下Git配置及使用
Windows环境下Git配置及使用 一.安装包位置 Git下载地址https://git-scm.com/download/win TortoiseGit下载地址https://tortoisegi ...
- linux 的计划任务 cron
https://serverfault.com/questions/587696/how-to-restart-php-fpm-from-cron 我也遇到了这个问题,想用cron 来启动php-fp ...
- 职场二年级转型C++的困惑
[来信] 老师.你好.看了你的博客和採訪.不由主自地给你发私信,感觉你能解答我的问题. 学生90后,2012年毕业于某不知名院校.两年工作经验(第一年C#,第二年java,直到如今),一直想转型C++ ...
- Java开发岗位面试题归类---怎么好好的准备面试,也算是发展学习方向
转载:http://blog.csdn.net/qq_27093465/article/details/52181860 一.Java基础 1. String类为什么是final的. 自己找的参考答案 ...
- FastIV图像处理
新建一图像处理算法群,主要讨论图像处理与计算机视觉中的快速算法及其工程实现. 群号码:322687422
- RTP Tools
RTP Tools (Version 1.20) https://wiki.wireshark.org/RTP_statistics Here is a small example: Install ...
- 通过LR监控Linux服务器性能
1)设置监控服务器要监控 UNIX 资源,必须配置 rstatd 守护程序.注意,可能已经配置了 rstatd守护程序,因为当计算机收到一个 rstatd 请求时,该计算机上的 inetd 自动激活r ...