简体   繁体   中英

RunListener result method

I have a class who extends RunListener.

I would like to know the result of the method. So in this method :

public void testFinished(Description description) throws java.lang.Exception {
    System.out.println("Finished execution of test case : " + description.getMethodName());
}

I would like something like : description.getResult(), but it doesn't existe. How can I make ?

thanks.

Whatever methods you can use depends on the Description object. If you want/need getResult() , you will have to implement that method in the Description class and make it public.

Example:

This is an example of the method you need to implement in your Description class.

public Object getResult() {
  // this is the method you need to implement, with whatever return type you need instead of Object (String etc.)
  return result;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM