Spring3 Junit测试

来源:互联网 发布:c语言预处理命令 编辑:程序博客网 时间:2024/06/04 19:16

首先,添加Junit的jar包,cfgligb.jar , asm.jar.

接下来,该开始编写测试程序了,右键新建Junit Test Case。

建好Test Case以后。具体程序如下:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"file:WebContent/WEB-INF/action.xml", "file:WebContent/WEB-INF/service.xml"})
public class ApicilentServiceTest {
 
 @Resource
 private AccountService service;
 
 @Test
 public void testGetAllApicilent() {
  //fail("Not yet implemented");
  //这里就可以调用service的方法了
 }

}

 

原创粉丝点击