美观的reprot是自动化不可少的一部分,哈哈

无论你用testng或者junit,只需要在onfailed,onsucess,onfinsh上回调生成报告的方法就可以了

 http://extentreports.com/

compile group: 'com.relevantcodes', name: 'extentreports', version:'2.40.2'

先看图:

Extentreports在安卓中的应用

 

1.初始化:

  private static ExtentReports extent;
    private ExtentTest test;
    private static String reportLocation = "/sdcard/ExtentReport2.html";

2.各个阶段的动作 

beforeclass

 @BeforeClass
    public static void beforeClass() throws IOException, PackageManager.NameNotFoundException {
        extent = new ExtentReports(reportLocation);

failed

  protected void failed(Throwable e, Description description) {
            super.failed(e, description);
            test.log(LogStatus.FAIL, e);

success

     protected void succeeded(Description description) {
            super.succeeded(description);
            test.log(LogStatus.PASS, "Pass");

afterclass

 @AfterClass
    public static void afterClass() throws IOException {
        extent.flush();
        extent.close();

 

是不是很简单

相关文章:

  • 2021-04-25
  • 2021-04-17
  • 2021-10-02
  • 2022-12-23
  • 2021-09-02
  • 2021-09-30
  • 2021-11-01
  • 2021-12-27
猜你喜欢
  • 2021-12-24
  • 2022-12-23
  • 2021-06-03
  • 2022-12-23
  • 2021-12-31
  • 2021-07-13
  • 2021-08-14
相关资源
相似解决方案