|
@@ -90,7 +90,7 @@ public class CoverageTest extends Thread{
|
|
|
install();
|
|
|
//覆盖安装
|
|
|
PrintUtil.print("Cover install", this.udid, TAG);
|
|
|
- install();
|
|
|
+ coverInstall();
|
|
|
//统计冷启动时间
|
|
|
measureColdStartTime();
|
|
|
PrintUtil.print("Uninstall", this.udid, TAG);
|
|
@@ -304,6 +304,20 @@ public class CoverageTest extends Thread{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void coverInstall() {
|
|
|
+ try {
|
|
|
+ checkDeviceOnline();
|
|
|
+ String command = "adb -s " + this.udid + " install -r " + this.apkPath;
|
|
|
+ String msg = OsUtil.runCommand(command);
|
|
|
+ BufferedWriter writer = new BufferedWriter(new FileWriter(
|
|
|
+ new File(this.logPath + File.separator + "CoverInstall.log"), false));
|
|
|
+ writer.write(msg);
|
|
|
+ writer.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void measureColdStartTime() {
|
|
|
checkDeviceOnline();
|
|
|
String command = "adb -s " + this.udid + " shell am start -W " + this.apkInfo.getPackageName() + "/" + this.apkInfo.getLaunchableActivity();
|
|
@@ -418,15 +432,8 @@ public class CoverageTest extends Thread{
|
|
|
}
|
|
|
|
|
|
private void killAppAndGoHome(){
|
|
|
- try {
|
|
|
- String pressHomeButton = "adb -s " + udid + " shell input keyevent 3";
|
|
|
- OsUtil.runCommand(pressHomeButton);
|
|
|
- Thread.sleep(1500);
|
|
|
- String killApp = "adb -s " + udid + " shell am kill " + this.apkInfo.getPackageName();
|
|
|
- OsUtil.runCommand(killApp);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+ String killApp = "adb -s " + udid + " shell am kill " + this.apkInfo.getPackageName();
|
|
|
+ OsUtil.runCommand(killApp);
|
|
|
}
|
|
|
|
|
|
private static void stopAppiumServer(String Port) {
|