美观的reprot是自动化不可少的一部分,哈哈
无论你用testng或者junit,只需要在onfailed,onsucess,onfinsh上回调生成报告的方法就可以了
http://extentreports.com/
compile group: 'com.relevantcodes', name: 'extentreports', version:'2.40.2'
先看图:
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();
是不是很简单