У меня есть прослушиватель TestNG, который реализует IInvokedMethodListener. В @BeforeMethod мне нужно настроить тестовый контекст, вот пример:
public class ThucydidesInvokedMethodListener implements IInvokedMethodListener2 {
public void beforeInvocation(final IInvokedMethod method, final ITestResult testResult) {
boolean areBeforeMethods = method.getTestMethod().getTestClass().getBeforeTestMethods().length > 0;
if ((areBeforeMethods && method.getTestMethod().getTestClass().getBeforeTestMethods()[0] == method.getTestMethod()) ||
!areBeforeMethods && method.isTestMethod()) {
final ThucydidesTestContext context = new ThucydidesTestContext(testResult);
testResult.setAttribute(contextKey(), context);
context.before();
}
}
но также мне нужно имя теста, которое будет выполняться после BeforeMethod, чтобы использовать это имя теста в отчетах. Возможно ли это с помощью TestNG? Также я пробовал IInvokedMethodListener2, который дополнительно имеет ITestContext, но также не предоставляет имя теста.