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 ...
随机推荐
- java中各种数据类型占用字节数
1字节(Byte)=8bit java的基本类型 类型 所占字节 byte 1 short 2 int 4 long 8 float 4 double 8 char 2 String中字母和汉字所占字 ...
- ylbtech-LanguageSamples-PartialTypes(部分类型)
ylbtech-Microsoft-CSharpSamples:ylbtech-LanguageSamples-PartialTypes(部分类型) 1.A,示例(Sample) 返回顶部 “分部类型 ...
- iOS:quartz2D绘图
Quartz-2D:绘图 一.介绍: •Quartz 2D是一个二维图形绘制引擎,支持iOS环境和Mac OS X环境 •Quartz 2D API可以实现许多功能,如基于路径的绘图.透明度.阴影 ...
- 公司机器(线上机器)启动ftp任务的命令
这个命令: /usr/local/proftp/sbin/proftpd 注意要在root账户,并且kill掉原来的同名进程.
- python scikit-learn选择正确估算器
下图摘自官方文档 链接 http://scikit-learn.org/stable/tutorial/machine_learning_map/index.html
- deferred rendering with msaa
https://docs.nvidia.com/gameworks/content/gameworkslibrary/graphicssamples/d3d_samples/antialiasedde ...
- 把文章里边的html标签去掉(去掉文字的样式,显示css设置的样式)
java: validHeasers.add(tr[0].replace("<(.[^>]*)>",""));//去除HTML标签
- http://www.cnblogs.com/ITtangtang/archive/2012/05/21/2511749.html
http://www.cnblogs.com/ITtangtang/archive/2012/05/21/2511749.html http://blog.sina.com.cn/s/blog_538 ...
- http://www.linuxidc.com/Linux/2016-04/129738.htm
http://www.linuxidc.com/Linux/2016-04/129738.htm
- Mac Finder 显示路径和复制路径
Mac Finder 显示路径和复制路径 学习了:https://www.jianshu.com/p/757f9ffc5acf 设置 defaults write com.apple.finder _ ...