Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在ExtentReports中添加跳过的测试用例?_Java_Selenium_Extentreports - Fatal编程技术网

Java 如何在ExtentReports中添加跳过的测试用例?

Java 如何在ExtentReports中添加跳过的测试用例?,java,selenium,extentreports,Java,Selenium,Extentreports,我需要将所有跳过的测试用例添加到ExtentReports。我怎样才能做到这一点 我在BaseTest.java中尝试了以下代码: 尝试实现ITestListener和以下方法: public interface ITestListener extends ITestNGListener { void onTestStart(ITestResult result); public void onTestSuccess(ITestResult result); public

我需要将所有跳过的测试用例添加到ExtentReports。我怎样才能做到这一点

我在BaseTest.java中尝试了以下代码:


尝试实现ITestListener和以下方法:

  public interface ITestListener extends ITestNGListener {

  void onTestStart(ITestResult result);

  public void onTestSuccess(ITestResult result);

  public void onTestFailure(ITestResult result);

  public void onTestSkipped(ITestResult result);

  public void onTestFailedButWithinSuccessPercentage(ITestResult result);

  public void onStart(ITestContext context);

  public void onFinish(ITestContext context);

}
所以实现看起来像这样:

public class test implements ITestListener {

    @Override
    public void onTestSkipped(ITestResult result) {
        ... do Your stuff for skip tests extent report here ...
    }

    @Override
    public void onTestSuccess(ITestResult result) {
        ... do Your stuff for passed test extent report here ...
    }

    ... and all other methods are automatically implemented, and You don't have to check status, test will automatically enter proper methods. 


    @Override
    public void onStart(ITestContext context){
          //init extent reports... on whatever way You do it...
    }


    @Override
    public void onFinish(ITestContext context){
        report.endTest(extentTest);
        report.flush(); 
    }

}
这是对所有测试的概括


希望这能有所帮助,

问题需要分类,以便引起能够回答它的人的注意(Java)。我已经尝试了以下代码:您的尝试结果如何?你能告诉我们你能和我们分享的任何错误信息吗?
public class test implements ITestListener {

    @Override
    public void onTestSkipped(ITestResult result) {
        ... do Your stuff for skip tests extent report here ...
    }

    @Override
    public void onTestSuccess(ITestResult result) {
        ... do Your stuff for passed test extent report here ...
    }

    ... and all other methods are automatically implemented, and You don't have to check status, test will automatically enter proper methods. 


    @Override
    public void onStart(ITestContext context){
          //init extent reports... on whatever way You do it...
    }


    @Override
    public void onFinish(ITestContext context){
        report.endTest(extentTest);
        report.flush(); 
    }

}