Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Testing Aspect Alone

I'm doing my project to develop a test tool for aspect-oriented programs. Now I am still at the stage of how to program to test the aspect alone and have some difficulties on this stage.

I have been thinking of how to test before(), after() and void around() advice which have no return value, which means no comparison can be made if there is no return value and hence no expected value for these advices as mentioned above. I've tried many ways to help implement the testing. One way is to add some extra code in advice to recognize the control flow, but adding code is really bad idea in testing field. The other way is to compare the resulting value of variables or invoked methods used in advice with expected value, but these variables or invoked methods with return value do not always happen in advice, for example, how to test the following simple before() advice:

public aspect MannersAspect {
   pointcut deliverMessage()
	: call(* MessageCommunicator.deliver(..));

   before() : deliverMessage() {
	System.out.print("Hello! ");
   }
}

Does anyone have any other ways to test these advice? Any suggestions are welcome.

Adrian

_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com


Back to the top