摘要
软件开发中,软件测试的作用越来越重要。目前,轻量级Java EE框架得到了广泛流行,如何在该框架下进行高效、方便的单元测试和集成测试,具有重要意义。从轻量级Java EE框架的特点出发,结合测试驱动开发(TDD)的理念,分析了采用Mock、EasyMock进行仿真单元测试的方法;利用依赖注入(DI)与事务管理进行集成测试;对Spring与Hibernate结合的一个集成测试问题,给出了运用面向切面编程的环绕通知的解决办法。文中总结的测试方法与经验,对于轻量级框架下的管理信息系统的测试准备、部署以及实施,能够显著提高效率,同时也有助于TDD团队的组织与合作。
Software testing plays a more and more important role in software development. At present, the light - weighted Java EE framework has been widely popular. In this framework, efficient and convenient unit testing and integration testing are of great significance. Based on the characteristics of light - weighted Java EE framework, combined with the idea of test - driven development (TDD), analyzes on using Mock, EasyMock to carry out simulation unit tests; makes the use of dependency injection (DI) and transaction manager to carry out integrated testing; a problem which occurs regularly in the integrated testing of Spring and Hibernate, is solved by the use of the around advice, one of the vital technologies in aspect - oriented programming (AOP). The test methods and experiences which are summed up in this article can significantly improve efficiency in test preparation, deployment and implementation of management information system under lightweight framework, also contribute to TDD team organization and cooperation.
出处
《计算机技术与发展》
2009年第9期115-118,185,共5页
Computer Technology and Development
基金
中央与地方高校共建实验室项目基金(301101000002)
南京工程学院科研基金项目(KXJ08071
KXJ08117)