作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2007, Vol. 33 ›› Issue (22): 76-79. doi: 10.3969/j.issn.1000-3428.2007.22.027

• 软件技术与数据库 • 上一篇    下一篇

基于AOP的面向对象程序的单元测试

张 艳,赵建军,冯 斌   

  1. (上海交通大学软件学院,上海 200240)
  • 收稿日期:1900-01-01 修回日期:1900-01-01 出版日期:2007-11-20 发布日期:2007-11-20

Object-oriented Unit Test Based on Aspect-oriented Programming

ZHANG Yan, ZHAO Jian-jun, FENG Bin   

  1. (School of Software, Shanghai Jiaotong University, Shanghai 200240)
  • Received:1900-01-01 Revised:1900-01-01 Online:2007-11-20 Published:2007-11-20

摘要: 单元测试被视为横切关注点,在软件测试过程中很重要。而面向方面编程(AOP)的主要目标就是分离横切关注点,因此,单元测试非常适合用AOP来解决。该文提出了在对面向对象程序进行单元测试时遇到的问题,并用AOP方法加以解决,同时比较了传统方法和AOP方法进行单元测试的优缺点。

关键词: 面向方面编程, 单元测试, AspectJ

Abstract: Unit test is regarded as crosscutting concern, which is a very important testing behavior in the process of software test. However, the main objective of aspect-oriented programming(AOP) is to separate crosscutting concerns, so AOP is fit for unit test. This paper brings forward several problems existing in object-oriented unit testing and shows how the AOP can be used to solve them. Virtues and shortcomings of using traditional method and AOP methods to support object-oriented unit test are compared.

Key words: aspect-oriented programming(AOP), unit test, AspectJ

中图分类号: