日期:2014-05-20  浏览次数:20862 次

jdbc的junit测试用例如何编写
工作中遇到的问题,测数据库的连接,检索异常,有大侠写过测试用例的没有,指点一二。

------解决方案--------------------
public class DeskServiceTest extends TestCaseEx {
private TDesk tdesk;
private DeskService objTest;
protected void setUp() throws Exception {
super.setUp();
tdesk = new TDesk();
tdeskofpro = new TDeskofpro();
objTest = (DeskService) Global.serviceFactory.getService( "deskService ");
}

protected void tearDown() throws Exception {
super.tearDown();
}

/*
* Test method for
* 'com.dawnpro.devplatform.commonbiz.desk.service.DeskService.addTDesk(TDesk) '
*/
public void testAddTDesk() {
tdesk.setFfunction( "基础数据 ");
tdesk.setFcontrol( "jcsj.jsp ");
tdesk.setFsort( "1 ");
TDesk result;
result = objTest.addTDesk(tdesk);
tdeskid = result.getFid().toString(); // 新增记录ID
assertNotNull(result);
}
}
------解决方案--------------------
blog 更新:
think in java 各章后练习答案.....
http://blog.csdn.net/heimaoxiaozi/