0

I have created a file with the name SeleniumTestListener.java and I have written the below code:

@override
@AfterMethod(alwaysrun=true)
public class UITestNGListener  extends AbstractWebDriverEventListener
{   

        // TODO Auto-generated method stub
        @Override
        @AfterTest(alwaysRun=true)
        public void onException(Throwable exception, WebDriver driver) {
        System.out.println("Failed Failed Failed");

    }

Now when I am trying to run the script(purposely making it to fail after login into my application)

But it is failing with a configuration issue

org.testng.TestNGException: Method onException requires 2 parameters but 0 were supplied in the @Configuration annotation.

Can someone please help how to pass the values(throwable exception, webdriver driver) for this?

Thanks much for the help

4

1 に答える 1

1
  1. @AfterMethodクラスでは使用できません。
  2. テスト メソッドでパラメーターを指定する場合は、これらのパラメーターを@Parameters注釈または .xml を使用して渡す必要があります@DataProvider
于 2012-11-08T16:05:27.070 に答える