![](/img/trans.png)
[英]Trying to match an AspectJ pointcut signature for any methods containing a variable
[英]AspectJ pointcut to match methods annotated with @Test
我正在為每個測試方法構建一個模塊,該模塊偵聽TestNG測試並在測試方法開始執行之前執行某些操作。 我只想知道何時test(method)開始執行,方法名稱以及可選的測試類名稱。
我成功地為testNG的調用者調用編寫了切入點。 有效。
@Pointcut("execution(* org.testng.internal.IInvoker.invokeTestMethods(..))")
相反,我想知道每個測試方法都使用@org.testng.annotations.Test
注釋,如何編寫切入點以捕獲每個使用@org.testng.annotations.Test
注釋的測試方法的執行@org.testng.annotations.Test
?
這是我的測試樣子
@BeforeClass
public void setup() {
//setup logic
}
@BeforeMethod
private void configure() {
//config logic
}
@Test
public void testLoad() {
//test
}
@Test
public void testForm() {
//test
}
我嘗試了一些切入點,結果發現它們是無效的。 注意:我正在使用加載時間編織。
嘗試這個
"execution(* *(..)) && @annotation(org.testng.annotations.Test)"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.