Chinaunix首页 | 论坛 | 博客
  • 博客访问: 92894
  • 博文数量: 18
  • 博客积分: 185
  • 博客等级: 入伍新兵
  • 技术积分: 215
  • 用 户 组: 普通用户
  • 注册时间: 2012-11-16 01:15
个人简介

。。。。

文章分类

全部博文(18)

文章存档

2015年(6)

2014年(3)

2012年(9)

我的朋友

分类: Java

2015-01-05 16:45:04

             <dependency>
                   <groupId> junitgroupId >
                   <artifactId> junitartifactId >
                   <version> 4.10version >
                   <scope> testscope >
             dependency>
             <dependency>
                <groupId> org.springframeworkgroupId >
                <artifactId> spring-testartifactId >
                <version> 3.2.6.RELEASEversion >
             dependency>
        <dependency>
                <groupId> org.springframeworkgroupId >
                <artifactId> spring-contextartifactId >
                <version> 3.2.6.RELEASEversion >
             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+" 秒 " );
        }
    } 
}
阅读(2063) | 评论(0) | 转发(0) |
0

上一篇:maven必用插件

下一篇:将博客搬至CSDN

给主人留下些什么吧!~~