Commit 09d36e59 by fangyuan

add 获取api 个数方法

parent 4b8eda1d
...@@ -8,6 +8,7 @@ import com.aventstack.extentreports.model.TestAttribute; ...@@ -8,6 +8,7 @@ import com.aventstack.extentreports.model.TestAttribute;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter; import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
import com.aventstack.extentreports.reporter.configuration.ChartLocation; import com.aventstack.extentreports.reporter.configuration.ChartLocation;
import com.aventstack.extentreports.reporter.configuration.Theme; import com.aventstack.extentreports.reporter.configuration.Theme;
import com.live.utils.GetFilesNum;
import org.testng.*; import org.testng.*;
import org.testng.xml.XmlSuite; import org.testng.xml.XmlSuite;
...@@ -112,7 +113,10 @@ public class ExtentTestNGIReporterListener implements IReporter { ...@@ -112,7 +113,10 @@ public class ExtentTestNGIReporterListener implements IReporter {
//怎么样解决cdn.rawgit.com访问不了的情况 //怎么样解决cdn.rawgit.com访问不了的情况
htmlReporter.config().setResourceCDN(ResourceCDN.EXTENTREPORTS); htmlReporter.config().setResourceCDN(ResourceCDN.EXTENTREPORTS);
htmlReporter.config().setDocumentTitle("自动化测试报告"); htmlReporter.config().setDocumentTitle("自动化测试报告");
htmlReporter.config().setReportName("小麦自动化测试报告");
// 递归获取所有api数
int apiNum= GetFilesNum.show(new File("src/main/java/com/live/cases"));
htmlReporter.config().setReportName("本报告覆盖"+apiNum+"个API");
htmlReporter.config().setChartVisibilityOnOpen(true); htmlReporter.config().setChartVisibilityOnOpen(true);
htmlReporter.config().setTestViewChartLocation(ChartLocation.TOP); htmlReporter.config().setTestViewChartLocation(ChartLocation.TOP);
htmlReporter.config().setTheme(Theme.STANDARD); htmlReporter.config().setTheme(Theme.STANDARD);
......
package com.live.utils; package com.live.utils;
import com.google.gson.internal.$Gson$Preconditions;
import java.io.File; import java.io.File;
/** /**
...@@ -10,12 +12,11 @@ public class GetFilesNum { ...@@ -10,12 +12,11 @@ public class GetFilesNum {
public static int num = 0; public static int num = 0;
public static void main(String[] args) { public static void main(String[] args) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
File file = new File("src/main/java/com/sow/cases");
show (file); System.out.println( show (new File("src/main/java/com/live/cases")));
System.out.println("有"+num+"个Jar文件");
} }
public static void show(File file) { public static int show(File file) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
for(File f : file.listFiles()) { for(File f : file.listFiles()) {
if(f.isFile()) { if(f.isFile()) {
...@@ -26,8 +27,7 @@ public class GetFilesNum { ...@@ -26,8 +27,7 @@ public class GetFilesNum {
show(f); show(f);
} }
} }
return num;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment