In your , declare the public.

In your listener, the onTestFailure method receives a result parameter. That result parameter knows the instance of the test class that threw the failure. Call the result‘s getInstance method to get the instance of the test class.

To get to the variable, first cast the instance to the right type (the type that declares the variable or method you want to ). Then fetch the variable from the instance.

Something like this:

public MyTestListener implements ITestListener {
    public void onTestFailure(ITestResult result) {
        Object instance = result.getInstance();

        MyXYZVariableType xyz = MyTestClass.class.cast(instance).xyz;


Source link


Please enter your comment!
Please enter your name here