Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] How to?

Hi,
 
I'd like to print the TestCase name from witch myMethod is called (not directly, but in the TestCase control-flow).
Is it possible via pointcut declaration? my code is shown below... 
 
public class MyClass {
  void xx() { myMethod(); }
  void myMethod() {...}
}
 
public void testM() {
  new MyClass().xx();
}
 
public aspect Analizer {
  pointcut testsFlow() :
      call(* MyClass.myMethod(..)) &&
      cflow(execution (* junit.framework.TestCase+.test*()));
  
  before() : testsFlow() {
    System.out.println(thisJoinPoint); // not working, must print "testM"...
  }
}
 
Thanks,
 
André

Back to the top