簡體   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