I want to add some common code (eg. log the name of the test to logback) to my testng tests via AOP. The following is my Aspect & test code:
@Aspect
@Component
public class TestAspect {
...
@Around(value = "execution(* *(..)) && @annotation(org.testng.annotations.Test)")
public Object test(@NotNull final ProceedingJoinPoint pjp) {
...
}}
@ContextConfiguration(classes = { mysample.SpringTestConfigurator.class })
@WebAppConfiguration
public class GlobalTest extends AbstractTestNGSpringContextTests {
...
@Test(enabled = true, priority = 1)
public void testOS() {
...
}}
But the Aspect is not called. Where is the problem ?