繁体   English   中英

RunListener结果方法

[英]RunListener result method

我有一个扩展RunListener的类。

我想知道该方法的结果。 所以在这种方法中:

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

我想要类似的东西:description.getResult(),但是它不存在。 我该怎么做?

谢谢。

可以使用的任何方法取决于Description对象。 如果需要/需要getResult() ,则必须在Description类中实现该方法并将其公开。

例:

这是您需要在Description类中实现的方法的示例。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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