Преглед на файлове

每次手动停止的时候,重置设备ADB连接以解决adb卡死的问题

LiHaoyu преди 5 години
родител
ревизия
3782f1e80b

+ 3 - 3
src/main/java/net/mooctest/www/android_auto_test/utils/AppiumManager.java

@@ -64,10 +64,10 @@ public class AppiumManager {
         try {
             String cmd = OsUtil.getCmd();
             int dp = (Integer.parseInt(port) + 100);
-            String comand = cmd + " Commands/newAppium.sh " + port + " " + udid + " " + exceptionLogsPath
+            String command = cmd + " Commands/newAppium.sh " + port + " " + udid + " " + exceptionLogsPath
                     + " " + appiumLogsPath + " " + dp;
-            PrintUtil.print("the comand is " + comand, TAG);
-            r.exec(comand);
+            PrintUtil.print("the comand is " + command, TAG);
+            r.exec(command);
         } catch (IOException e1) {
             // TODO Auto-generated catch block
             e1.printStackTrace();

+ 11 - 0
src/main/java/net/mooctest/www/android_auto_test/utils/CoverageTest.java

@@ -466,9 +466,20 @@ public class CoverageTest extends Thread{
         if (script != null){
             script.endScript();
         }
+        try {
+            Thread.sleep(10000);
+        } catch (Exception ignored) { }
+        reconnectDeviceAdb();
         stopAppiumServer(this.port);
     }
 
+    private void reconnectDeviceAdb(){
+        try {
+            String command = String.format("adb -s %s reconnect", udid);
+            OsUtil.runCommand(command);
+        }catch (Exception ignored){ }
+    }
+
     private void checkEndFlag(){
         if (this.stopFlag){
             throw new TraceTimeoutException();

+ 0 - 9
src/main/java/net/mooctest/www/android_auto_test/utils/DriverUtil.java

@@ -1,9 +0,0 @@
-package net.mooctest.www.android_auto_test.utils;
-
-
-/**
- * @author henrylee
- */
-public class DriverUtil {
-
-}