|
@@ -13,6 +13,7 @@ import net.mooctest.www.android_auto_test.common.constant.Consts;
|
|
import net.mooctest.www.android_auto_test.common.exceptions.AppiumDriverInitException;
|
|
import net.mooctest.www.android_auto_test.common.exceptions.AppiumDriverInitException;
|
|
import net.mooctest.www.android_auto_test.common.exceptions.TraceTimeoutException;
|
|
import net.mooctest.www.android_auto_test.common.exceptions.TraceTimeoutException;
|
|
import net.mooctest.www.android_auto_test.common.constant.enums.DeviceRunningStatus;
|
|
import net.mooctest.www.android_auto_test.common.constant.enums.DeviceRunningStatus;
|
|
|
|
+import net.mooctest.www.android_auto_test.groovy.GroovyExecutor;
|
|
import net.mooctest.www.android_auto_test.models.Device;
|
|
import net.mooctest.www.android_auto_test.models.Device;
|
|
import net.mooctest.www.android_auto_test.services.DeviceService;
|
|
import net.mooctest.www.android_auto_test.services.DeviceService;
|
|
import org.openqa.selenium.NoSuchSessionException;
|
|
import org.openqa.selenium.NoSuchSessionException;
|
|
@@ -62,6 +63,7 @@ public class CoverageTest extends Thread{
|
|
private AbstractBaseScript script;
|
|
private AbstractBaseScript script;
|
|
private DeviceService deviceService;
|
|
private DeviceService deviceService;
|
|
private String coldStartTime = "unknown";
|
|
private String coldStartTime = "unknown";
|
|
|
|
+ private String customScriptName = null;
|
|
|
|
|
|
public CoverageTest(ApkInfo apkInfo, String apkPath, Device device, String traceId){
|
|
public CoverageTest(ApkInfo apkInfo, String apkPath, Device device, String traceId){
|
|
deviceService = (DeviceService) BeanFactory.getBean(DeviceService.class);
|
|
deviceService = (DeviceService) BeanFactory.getBean(DeviceService.class);
|
|
@@ -76,6 +78,10 @@ public class CoverageTest extends Thread{
|
|
DeviceUtil.saveDeviceInfo(traceId, udid);
|
|
DeviceUtil.saveDeviceInfo(traceId, udid);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void setCustomScriptName(String name){
|
|
|
|
+ customScriptName = name;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
deviceService.updateDeviceRunningStatus(traceId, udid, DeviceRunningStatus.PREPARE);
|
|
deviceService.updateDeviceRunningStatus(traceId, udid, DeviceRunningStatus.PREPARE);
|
|
@@ -290,10 +296,13 @@ public class CoverageTest extends Thread{
|
|
}
|
|
}
|
|
|
|
|
|
private void executeScript(){
|
|
private void executeScript(){
|
|
- PrintUtil.print("use the default script " + udid, TAG, udid);
|
|
|
|
-// script = new DemoScript(udid, driver, apkInfo, traceId);
|
|
|
|
- script = new DefaultScript(udid, driver, apkInfo, traceId);
|
|
|
|
- script.runAndroidAutoTest();
|
|
|
|
|
|
+ if (customScriptName == null) {
|
|
|
|
+ PrintUtil.print("use the default script " + udid, TAG, udid);
|
|
|
|
+ script = new DefaultScript(udid, driver, apkInfo, traceId);
|
|
|
|
+ script.runAndroidAutoTest();
|
|
|
|
+ }else {
|
|
|
|
+ GroovyExecutor.executeMethod(customScriptName, "test", new Object[]{driver});
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
private void install() {
|
|
private void install() {
|