web项目测试环境

来源:互联网 发布:阿里云服务器下载文件 编辑:程序博客网 时间:2024/06/06 04:47
             <dependency>
                   <groupId> junit</groupId >
                   <artifactId> junit</artifactId >
                   <version> 4.10</version >
                   <scope> test</scope >
             </dependency>
             <dependency>
                <groupId> org.springframework</groupId >
                <artifactId> spring-test</artifactId >
                <version> 3.2.6.RELEASE</version >
             </dependency>
        <dependency>
                <groupId> org.springframework</groupId >
                <artifactId> spring-context</artifactId >
                <version> 3.2.6.RELEASE</version >
             </dependency>

@RunWith(SpringJUnit4ClassRunner. class //使用junit4进行测试 
@ContextConfiguration  
({
    "file:src/main/webapp/WEB-INF/applicationContext-datasource.xml",
    "file:src/main/webapp/WEB-INF/spring/*.xml"
    ...
}) //加载配置文件 
public class BaseJunit4Test { 
     @Test 

    public void testInsertUserAssign() { }
}  

public class UserinfoTest extends BaseJunit4Test{
    @Resource  //自动注入,默认按名称 
    private UserInfoManager userInfoManager;
   
    @Test   //标明是测试方法 
    //@Transactional   //标明此方法需使用事务 
    //@Rollback(false)  //标明使用完此方法后事务不回滚,true时为回滚 
    public void testInsertUserAssign() { 
        for(int i=0;i<10;i++){
            Long a = System. currentTimeMillis();
            userInfoManager.getByUUID("85ced0e9-3e54-11e4-b372-005056b76f10" );
            System. out.println("userInfo执行耗时 : "+(System.currentTimeMillis ()-a)/1000f+" 秒 " );
        }
    } 
}
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
阅读(4) | 评论(0) | 转发(0) |
0

上一篇:maven必用插件

下一篇:将博客搬至CSDN

相关热门文章
  • fondamentale. bottes ralph l...
  • lacoste soldes de Bragelonne...
  • théologie... ralph lauren f...
  • polo lacoste pas cher, Mon i...
  • Eidgenossenschaft.. polo ral...
  • JDK1.6官方下载_JDK6官方下载_...
  • MyEclipse6.5下载及注册码...
  • Eclipse 插件安装、升级和卸载...
  • Eclipse+MyEclipse的配置
  • java.net.BindException: Addr...
  • 谁能够帮我解决LINUX 2.6 10...
  • 现在的博客积分不会更新了吗?...
  • shell怎么读取网页内容...
  • ssh等待连接的超时问题...
  • curl: (56) Recv failure: Con...
给主人留下些什么吧!~~
原创粉丝点击