<
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() { }
@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+
" 秒 "
);
}
}
}
相关热门文章
- fondamentale. bottes ralph l...
- lacoste soldes de Bragelonne...
- théologie... ralph lauren f...
- polo lacoste pas cher, Mon i...
- Eidgenossenschaft.. polo ral...
给主人留下些什么吧!~~
评论热议