摘要: 单元测试被视为横切关注点,在软件测试过程中很重要。而面向方面编程(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
中图分类号:
张 艳;赵建军;冯 斌. 基于AOP的面向对象程序的单元测试[J]. 计算机工程, 2007, 33(22): 76-79.
ZHANG Yan; ZHAO Jian-jun; FENG Bin. Object-oriented Unit Test Based on Aspect-oriented Programming[J]. Computer Engineering, 2007, 33(22): 76-79.