From 9f9b419c3fbcc01fd9f73d5d225f2e7521954381 Mon Sep 17 00:00:00 2001 From: varundtsfi Date: Thu, 19 Sep 2019 16:28:19 +0530 Subject: [PATCH 1/3] TestRunner property added and Error Handling --- Java/EspressOrchProject/config.properties | 50 ++++++++++++++++--- .../espresso/orchstrator/ConfigFileLoad.java | 4 ++ .../orchstrator/EspressoOrch_Main.java | 32 +++++++++--- 3 files changed, 73 insertions(+), 13 deletions(-) diff --git a/Java/EspressOrchProject/config.properties b/Java/EspressOrchProject/config.properties index 9b3bccbb..74caf27b 100644 --- a/Java/EspressOrchProject/config.properties +++ b/Java/EspressOrchProject/config.properties @@ -1,8 +1,44 @@ -pCloudyEndpoint = https://device.pcloudy.com -pCloudyUsername = pratap.kumar@sstsinc.com -pCloudyApiKey = 3m4t8ys47mmrz8zy7cmqbr3f +///////////////////////////////////////////////////////////////////////////////////// +// +// pCloudy Espresso Configuration +// +///////////////////////////////////////////////////////////////////////////////////// +// URL of the cloud you want to run your test on +pCloudyEndpoint = https://varun-pc.pcloudy.com + +// Your pcloudy User name +pCloudyUsername = varun.kumar@sstsinc.com + +// Your API Key. Log in to pcloudy->Settings->Profile. and copy your API key. +pCloudyApiKey = 7p8b79ddysccytqw2nkzhks2 + +// How long do you want to book the devices for Espresso DurationInMinutes = 10 -DeviceIds = 487 -ApkFilePath = /home/radmin/Espress_OrchApk/app-debug.apk -TestApkPath = /home/radmin/Espress_OrchApk/app-debug-androidTest.apk -TestCycleName = Testcycletest + +// IDs of the devices you want to run Espresso on +// You can get the device list using the API. +// https://content.pcloudy.com/apidocs/index.html#get-device-list +DeviceIds = 32 + +// Location of the Application you want to test in your local machine +ApkFilePath = /home/radmin/AndroidStudioProjects/BasicSample/app/build/outputs/apk/debug/app-debug.apk + +// Location of the test APK in your local machine +TestApkPath = /home/radmin/AndroidStudioProjects/BasicSample/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk + +// Location of the Orchestrator APK +OrchstratorApkPath = /home/radmin/build/orchestrator-1.1.0.apk + +// Location of the service APK +ServiceApkPath = /home/radmin/build/test-services-1.1.0.apk + +// Name of the test Session. +TestCycleName = Varun-Espresso + +//List of suites that you want to run. (In Quotes and Comma Separated) +Suites = "com.example.android.testing.espresso.BasicSample.UnitTestSuite" + +//example:- +//androidx.test.runner.AndroidJUnitRunner +//android.support.test.runner.AndroidJUnitRunner +TestRunner = "android.support.test.runner.AndroidJUnitRunner"; \ No newline at end of file diff --git a/Java/EspressOrchProject/src/com/ssts/pcloudy/espresso/orchstrator/ConfigFileLoad.java b/Java/EspressOrchProject/src/com/ssts/pcloudy/espresso/orchstrator/ConfigFileLoad.java index 5d66ab8f..b709b364 100644 --- a/Java/EspressOrchProject/src/com/ssts/pcloudy/espresso/orchstrator/ConfigFileLoad.java +++ b/Java/EspressOrchProject/src/com/ssts/pcloudy/espresso/orchstrator/ConfigFileLoad.java @@ -69,6 +69,10 @@ public String get_TestSuites(){ return prop.getProperty("Suites"); } + public String get_TestRunner(){ + return prop.getProperty("TestRunner"); + } + public String get_cycleName(){ return prop.getProperty("TestCycleName"); } diff --git a/Java/EspressOrchProject/src/com/ssts/pcloudy/espresso/orchstrator/EspressoOrch_Main.java b/Java/EspressOrchProject/src/com/ssts/pcloudy/espresso/orchstrator/EspressoOrch_Main.java index 64993000..3efeaf83 100644 --- a/Java/EspressOrchProject/src/com/ssts/pcloudy/espresso/orchstrator/EspressoOrch_Main.java +++ b/Java/EspressOrchProject/src/com/ssts/pcloudy/espresso/orchstrator/EspressoOrch_Main.java @@ -18,24 +18,44 @@ public class EspressoOrch_Main { static Connector con; + @SuppressWarnings("unused") public static void main(String[] args) throws Exception { + String apiEndpoint = ConfigFileLoad.getInstance().get_pCloudyEndpoint(); System.out.println("Api Endpoint: " + apiEndpoint); + String userName = ConfigFileLoad.getInstance().get_pCloudyUserName(); System.out.println("User Name: " + userName); + String accessKey = ConfigFileLoad.getInstance().get_pCloudyApiKey(); System.out.println("AccessKey: " + accessKey); int duration = ConfigFileLoad.getInstance().get_Duration(); - String deviceIds = ConfigFileLoad.getInstance().get_DeviceIds(); - String cycleName = ConfigFileLoad.getInstance().get_cycleName(); - String apkPath = ConfigFileLoad.getInstance().get_ApplicationPath(); - String testApkPath = ConfigFileLoad.getInstance().get_TestApkPath(); - String orchApkPath = ConfigFileLoad.getInstance().get_OrchApkPath(); + + String deviceIds = ConfigFileLoad.getInstance().get_DeviceIds(); + + String cycleName = ConfigFileLoad.getInstance().get_cycleName(); + + String apkPath = ConfigFileLoad.getInstance().get_ApplicationPath(); + + String testApkPath = ConfigFileLoad.getInstance().get_TestApkPath(); + + String orchApkPath = ConfigFileLoad.getInstance().get_OrchApkPath(); + String serviceApkPath = ConfigFileLoad.getInstance().get_ServiceApkPath(); - String testSuites = ConfigFileLoad.getInstance().get_TestSuites(); + String testSuites = ConfigFileLoad.getInstance().get_TestSuites(); + + String testRunner = ConfigFileLoad.getInstance().get_TestRunner(); + if(testRunner.isEmpty()) { + System.out.println("TestRunner Can't be empty"); + System.exit(0); + } + + System.out.println("testSuites: " + testSuites); + System.out.println("TestRunner: " + testRunner); + File apkFile = new File(apkPath); File testFile = new File(testApkPath); From d5573bfb203419b8455709f4cc2df5aef6ecc32d Mon Sep 17 00:00:00 2001 From: varundtsfi Date: Fri, 25 Oct 2019 08:59:14 +0530 Subject: [PATCH 2/3] Espresso automation project error handled and new method added --- Java/EspressOrchProject/config.properties | 64 ++--- Java/EspressOrchProject/lib/config.properties | 50 +++- .../pcloudy/espressorch/ConfigFileLoad.java | 80 ++++++ .../espressorch/EspressoOrch_Main.java | 269 ++++++++++++++++++ 4 files changed, 424 insertions(+), 39 deletions(-) create mode 100644 Java/EspressOrchProject/src/com/pcloudy/espressorch/ConfigFileLoad.java create mode 100644 Java/EspressOrchProject/src/com/pcloudy/espressorch/EspressoOrch_Main.java diff --git a/Java/EspressOrchProject/config.properties b/Java/EspressOrchProject/config.properties index 74caf27b..b8a21fdb 100644 --- a/Java/EspressOrchProject/config.properties +++ b/Java/EspressOrchProject/config.properties @@ -1,44 +1,44 @@ -///////////////////////////////////////////////////////////////////////////////////// -// -// pCloudy Espresso Configuration -// -///////////////////////////////////////////////////////////////////////////////////// -// URL of the cloud you want to run your test on -pCloudyEndpoint = https://varun-pc.pcloudy.com - -// Your pcloudy User name +#///////////////////////////////////////////////////////////////////////////////////// +#// +#// pCloudy Espresso Configuration +#// +#///////////////////////////////////////////////////////////////////////////////////// +# URL of the cloud you want to run your test on +pCloudyEndpoint = https://android-lab.pcloudy.com + +# Your pcloudy User name pCloudyUsername = varun.kumar@sstsinc.com -// Your API Key. Log in to pcloudy->Settings->Profile. and copy your API key. -pCloudyApiKey = 7p8b79ddysccytqw2nkzhks2 +# Your API Key. Log in to pcloudy->Settings->Profile and copy your API key. +pCloudyApiKey = r68c2g2cm5mspyzyw7jh645g -// How long do you want to book the devices for Espresso +# How long do you want to book the devices for Espresso DurationInMinutes = 10 -// IDs of the devices you want to run Espresso on -// You can get the device list using the API. -// https://content.pcloudy.com/apidocs/index.html#get-device-list -DeviceIds = 32 +# IDs of the devices you want to run Espresso on +# You can get the device list using the API. +# https://content.pcloudy.com/apidocs/index.html#get-device-list +DeviceIds = 42 -// Location of the Application you want to test in your local machine -ApkFilePath = /home/radmin/AndroidStudioProjects/BasicSample/app/build/outputs/apk/debug/app-debug.apk +# Location of the Application you want to test in your local machine +ApkFilePath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/pCloudyVector.apk -// Location of the test APK in your local machine -TestApkPath = /home/radmin/AndroidStudioProjects/BasicSample/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk +# Location of the test APK in your local machine +TestApkPath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/pCloudyVectorTest.apk -// Location of the Orchestrator APK -OrchstratorApkPath = /home/radmin/build/orchestrator-1.1.0.apk +# Location of the Orchestrator APK +OrchstratorApkPath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/orchestrator-1.1.0.apk -// Location of the service APK -ServiceApkPath = /home/radmin/build/test-services-1.1.0.apk +# Location of the service APK +ServiceApkPath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/test-services-1.1.0.apk -// Name of the test Session. -TestCycleName = Varun-Espresso +# Name of the test Session +TestCycleName = 27Sep-ESP -//List of suites that you want to run. (In Quotes and Comma Separated) -Suites = "com.example.android.testing.espresso.BasicSample.UnitTestSuite" +#List of suites that you want to run (In Quotes and Comma Separated) +Suites = com.checkmytrip.integration.data.TestSuiteNre -//example:- -//androidx.test.runner.AndroidJUnitRunner -//android.support.test.runner.AndroidJUnitRunner -TestRunner = "android.support.test.runner.AndroidJUnitRunner"; \ No newline at end of file +#example:- +#androidx.test.runner.AndroidJUnitRunner +#android.support.test.runner.AndroidJUnitRunner +TestRunner = android.support.test.runner.AndroidJUnitRunner diff --git a/Java/EspressOrchProject/lib/config.properties b/Java/EspressOrchProject/lib/config.properties index 9b3bccbb..b8a21fdb 100644 --- a/Java/EspressOrchProject/lib/config.properties +++ b/Java/EspressOrchProject/lib/config.properties @@ -1,8 +1,44 @@ -pCloudyEndpoint = https://device.pcloudy.com -pCloudyUsername = pratap.kumar@sstsinc.com -pCloudyApiKey = 3m4t8ys47mmrz8zy7cmqbr3f +#///////////////////////////////////////////////////////////////////////////////////// +#// +#// pCloudy Espresso Configuration +#// +#///////////////////////////////////////////////////////////////////////////////////// +# URL of the cloud you want to run your test on +pCloudyEndpoint = https://android-lab.pcloudy.com + +# Your pcloudy User name +pCloudyUsername = varun.kumar@sstsinc.com + +# Your API Key. Log in to pcloudy->Settings->Profile and copy your API key. +pCloudyApiKey = r68c2g2cm5mspyzyw7jh645g + +# How long do you want to book the devices for Espresso DurationInMinutes = 10 -DeviceIds = 487 -ApkFilePath = /home/radmin/Espress_OrchApk/app-debug.apk -TestApkPath = /home/radmin/Espress_OrchApk/app-debug-androidTest.apk -TestCycleName = Testcycletest + +# IDs of the devices you want to run Espresso on +# You can get the device list using the API. +# https://content.pcloudy.com/apidocs/index.html#get-device-list +DeviceIds = 42 + +# Location of the Application you want to test in your local machine +ApkFilePath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/pCloudyVector.apk + +# Location of the test APK in your local machine +TestApkPath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/pCloudyVectorTest.apk + +# Location of the Orchestrator APK +OrchstratorApkPath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/orchestrator-1.1.0.apk + +# Location of the service APK +ServiceApkPath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/test-services-1.1.0.apk + +# Name of the test Session +TestCycleName = 27Sep-ESP + +#List of suites that you want to run (In Quotes and Comma Separated) +Suites = com.checkmytrip.integration.data.TestSuiteNre + +#example:- +#androidx.test.runner.AndroidJUnitRunner +#android.support.test.runner.AndroidJUnitRunner +TestRunner = android.support.test.runner.AndroidJUnitRunner diff --git a/Java/EspressOrchProject/src/com/pcloudy/espressorch/ConfigFileLoad.java b/Java/EspressOrchProject/src/com/pcloudy/espressorch/ConfigFileLoad.java new file mode 100644 index 00000000..689c05c7 --- /dev/null +++ b/Java/EspressOrchProject/src/com/pcloudy/espressorch/ConfigFileLoad.java @@ -0,0 +1,80 @@ +package com.pcloudy.espressorch; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.Properties; + +public class ConfigFileLoad { + + Properties prop = new Properties(); + + static ConfigFileLoad instance = new ConfigFileLoad(); + + public static ConfigFileLoad getInstance() { + return instance; + } + + private ConfigFileLoad() { + InputStream input = null; + File file = new File("config.properties"); + try { + input = new FileInputStream(file.getAbsolutePath()); + prop.load(input); + input.close(); + } catch (Exception ex) { + + } + } + + public String get_pCloudyEndpoint() { + return prop.getProperty("pCloudyEndpoint"); + } + + public String get_pCloudyUserName() { + return prop.getProperty("pCloudyUsername"); + } + + public String get_pCloudyApiKey() { + return prop.getProperty("pCloudyApiKey"); + } + + public int get_Duration(){ + return Integer.parseInt(prop.getProperty("DurationInMinutes")); + } + + public String get_DeviceIds() { + return prop.getProperty("DeviceIds"); + + } + + public String get_ApplicationPath() { + return prop.getProperty("ApkFilePath"); + + } + + public String get_TestApkPath() { + return prop.getProperty("TestApkPath"); + } + + public String get_OrchApkPath(){ + return prop.getProperty("OrchstratorApkPath"); + } + + public String get_ServiceApkPath(){ + return prop.getProperty("ServiceApkPath"); + } + + public String get_TestSuites(){ + return prop.getProperty("Suites"); + } + + public String get_TestRunner(){ + return prop.getProperty("TestRunner"); + } + + public String get_cycleName(){ + return prop.getProperty("TestCycleName"); + } + +} diff --git a/Java/EspressOrchProject/src/com/pcloudy/espressorch/EspressoOrch_Main.java b/Java/EspressOrchProject/src/com/pcloudy/espressorch/EspressoOrch_Main.java new file mode 100644 index 00000000..b8b04c01 --- /dev/null +++ b/Java/EspressOrchProject/src/com/pcloudy/espressorch/EspressoOrch_Main.java @@ -0,0 +1,269 @@ +package com.pcloudy.espressorch; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.ssts.pcloudy.Connector; +import com.ssts.pcloudy.dto.automation.AutomationIntrruptResponse.AutomationIntrruptResult; +import com.ssts.pcloudy.dto.automation.ScheduleAutomationResponse.ScheduleAutomationResult; +import com.ssts.pcloudy.dto.device.MobileDevice; +import com.ssts.pcloudy.dto.file.PDriveFileDTO; +import com.ssts.pcloudy.exception.ConnectError; + +public class EspressoOrch_Main { + static String deviceIds; + static String authToken; + static Connector con; + + @SuppressWarnings("unused") + public static void main(String[] args) throws Exception { + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + try { + Thread.sleep(200); + //System.out.println("Shutting down ..."); + Cleanup_automation(authToken, deviceIds); + + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ConnectError e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + String apiEndpoint = ConfigFileLoad.getInstance().get_pCloudyEndpoint(); + System.out.println("Api Endpoint: " + apiEndpoint); + + String userName = ConfigFileLoad.getInstance().get_pCloudyUserName(); + System.out.println("User Name: " + userName); + + String accessKey = ConfigFileLoad.getInstance().get_pCloudyApiKey(); + System.out.println("AccessKey: " + accessKey); + + int duration = ConfigFileLoad.getInstance().get_Duration(); + + deviceIds = ConfigFileLoad.getInstance().get_DeviceIds(); + + String cycleName = ConfigFileLoad.getInstance().get_cycleName(); + + String apkPath = ConfigFileLoad.getInstance().get_ApplicationPath(); + + String testApkPath = ConfigFileLoad.getInstance().get_TestApkPath(); + + String orchApkPath = ConfigFileLoad.getInstance().get_OrchApkPath(); + + String serviceApkPath = ConfigFileLoad.getInstance().get_ServiceApkPath(); + + String testSuites = ConfigFileLoad.getInstance().get_TestSuites(); + + String testRunner = ConfigFileLoad.getInstance().get_TestRunner(); + + if(testRunner.isEmpty()) { + System.out.println("TestRunner Can't be empty"); + System.exit(0); + } + + System.out.println("testSuites: " + testSuites); + System.out.println("TestRunner: " + testRunner); + + File apkFile = new File(apkPath); + File testFile = new File(testApkPath); + + File orchFile = new File(orchApkPath); + File serviceApk = new File(serviceApkPath); + + scheduleEspressoTest(apiEndpoint, userName, accessKey, duration, deviceIds, apkFile, testFile, orchFile, serviceApk, testSuites,cycleName, testRunner); + } + + public static void Cleanup_automation(String authToken, String deviceIds) throws IOException, ConnectError { + deviceIds = "\"" + deviceIds + "\""; + //System.out.println("Automation force stop. "+deviceIds); + AutomationIntrruptResult aiResult = con.AutomationAPIs().intrruptAutomation(authToken, deviceIds); + System.out.println("Result "+aiResult.msg); + } + + @SuppressWarnings("null") + public static void scheduleEspressoTest(String endpoint, String userName, String accessKey, Integer duration, String deviceIds, File fileToUpload, File testFile, File orchFile, File serviceFile, String testSuites, + String cycleName, String testRunner) throws Exception { + + con = new Connector(endpoint); + + authToken = con.authenticateUser(userName, accessKey); + + System.out.println("Authentication success."); + + System.out.println("Apk files upload in progress. Please wait!!"); + + PDriveFileDTO orchDto = con.getAvailableAppIfUploaded(authToken, orchFile.getName()); + if (orchDto == null) { + orchDto = con.uploadApp(authToken, orchFile, false); + } + + PDriveFileDTO serviceApp = con.getAvailableAppIfUploaded(authToken, serviceFile.getName()); + if (serviceApp == null) { + serviceApp = con.uploadApp(authToken, serviceFile, false); + } + + PDriveFileDTO apkFileDto = con.getAvailableAppIfUploaded(authToken, fileToUpload.getName()); + + if (apkFileDto == null) { + apkFileDto = con.uploadApp(authToken, fileToUpload, false); + } else { + + con.deleteFileFromCloud(authToken, apkFileDto.file, "data"); + + apkFileDto = con.uploadApp(authToken, fileToUpload, false); + } + + PDriveFileDTO testFileDto = con.getAvailableAppIfUploaded(authToken, testFile.getName()); + + if (testFileDto == null) { + testFileDto = con.uploadApp(authToken, testFile, false); + } else { + + con.deleteFileFromCloud(authToken, testFileDto.file, "data"); + + testFileDto = con.uploadApp(authToken, testFile, false); + } + System.out.println("Apk files uploaded successfully."); + + ScheduleAutomationResult espressoResult = con.AutomationAPIs().executeEspressoByOrch(authToken, duration, deviceIds, apkFileDto, testFileDto, orchDto, serviceApp, testSuites, cycleName, testRunner); + + System.out.println("Your Espresso test session has been scheduled sucessfully."); + + waitForAutomationCompleted(con, authToken, deviceIds, espressoResult.tid); + //AutomationReportURL url = con.AutomationAPIs().getEspressoReportURL(authToken, espressoResult.tid); + + //System.out.println("Url Endpoint: "+con.getApiEndpoint()); + String[] splitedString =con.getApiEndpoint().split("api"); + + System.out.println("Report URL: "+endpoint+"/execution_report/"+espressoResult.tid+"?key="+authToken); + + + } + + public static void waitForAutomationCompleted(Connector con, String authToken, String devices, int tid) throws IOException, ConnectError, InterruptedException { + String status = ""; + + try + { + while (!status.equalsIgnoreCase("Completed")) { + Thread.sleep(10000); + status = con.AutomationAPIs().getAutomationStatus(authToken, tid, devices); + System.out.println("Status: " + status); + } + + + } + catch(Exception ex) { + System.out.println("Error is "+ex.toString()); + } + + } + + public void espressoSchedule(String endpoint, String userName, String accessKey) throws IOException, ConnectError { + Connector con = new Connector(endpoint); + String authToken = con.authenticateUser(userName, accessKey); + + File fileToUpload = new File("/home/radmin/Downloads/com.ba.mobile.apk"); + + PDriveFileDTO uploadedApp = con.getAvailableAppIfUploaded(authToken, fileToUpload.getName()); + if (uploadedApp == null) { + System.out.println("Unable to find any app by name: " + fileToUpload.getName() + ". \nPress any key to re-upload"); + + uploadedApp = con.uploadApp(authToken, fileToUpload); + System.out.println("File uploaded again. Now it should have been 0 KB in Cloud Drive"); + } + + } + + public static List bookDevicesForEspressoOrch(String authToken, List devices, Integer durationInMnutes, String friendlySessionName, String platform, + boolean skipNotAvailableDevices) throws ConnectError, IOException { + // Connector con = new Connector(); + + if (skipNotAvailableDevices) { + MobileDevice[] availableDevices = con.getDevices(authToken, 10, platform, true); + List availableDevicesList = new ArrayList(Arrays.asList(availableDevices)); + List deviceIds = getMobileIds(devices); + List availableDevicesIds = getMobileIds(availableDevicesList); + Map deviceMap = getdevicesMap(devices); + deviceIds = intersection(deviceIds, availableDevicesIds); + ArrayList finalDevicesList = new ArrayList<>(); + for (Integer currentAvailableDeviceIds : deviceIds) { + finalDevicesList.add(deviceMap.get(currentAvailableDeviceIds)); + } + List notAvailableDevicesList = intersection1(devices, finalDevicesList); + if (notAvailableDevicesList.size() != 0) { + for (int i = 0; i < notAvailableDevicesList.size(); i++) { + System.out.println(notAvailableDevicesList.get(i).manufacturer + " " + notAvailableDevicesList.get(i).display_name + " is not available"); + } + } + + devices = finalDevicesList; + } + return devices; + } + + static List getMobileIds(List list) { + List ids = new ArrayList<>(); + for (MobileDevice device : list) { + ids.add(device.id); + } + return ids; + } + + static Map getdevicesMap(List list1) { + Map map = new HashMap(); + for (MobileDevice device : list1) { + map.put(device.id, device); + } + return map; + } + + public static List intersection(List list1, List list2) { + List list = new ArrayList<>(); + for (T t : list1) { + if (list2.contains(t)) { + list.add(t); + } + } + return list; + } + + public static List intersection1(List list1, List list2) { + List list = new ArrayList<>(); + for (T t : list1) { + if (!list2.contains(t)) { + list.add(t); + } + } + return list; + } + + private static List mobileDevices(String authToken, String deviceids) throws ConnectError, IOException { + MobileDevice[] devices = con.getDevices(authToken, 5, "android", true); + + List selectedDevices = new ArrayList(); + + String[] arr = deviceids.split(","); + + for (String id : arr) { + MobileDevice device = devices[Integer.parseInt(id)]; + selectedDevices.add(device); + } + + return selectedDevices; + + } + +} From 54e6c141fa2b30f667a8a2604091fbb22b6071bd Mon Sep 17 00:00:00 2001 From: varundtsfi Date: Fri, 25 Oct 2019 09:01:42 +0530 Subject: [PATCH 3/3] Config file path changes --- Java/EspressOrchProject/config.properties | 10 +++++----- Java/EspressOrchProject/lib/config.properties | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Java/EspressOrchProject/config.properties b/Java/EspressOrchProject/config.properties index b8a21fdb..5ba9628d 100644 --- a/Java/EspressOrchProject/config.properties +++ b/Java/EspressOrchProject/config.properties @@ -21,19 +21,19 @@ DurationInMinutes = 10 DeviceIds = 42 # Location of the Application you want to test in your local machine -ApkFilePath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/pCloudyVector.apk +ApkFilePath = /home/pCloudyVector.apk # Location of the test APK in your local machine -TestApkPath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/pCloudyVectorTest.apk +TestApkPath = /home/pCloudyVectorTest.apk # Location of the Orchestrator APK -OrchstratorApkPath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/orchestrator-1.1.0.apk +OrchstratorApkPath = /home/orchestrator-1.1.0.apk # Location of the service APK -ServiceApkPath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/test-services-1.1.0.apk +ServiceApkPath = /home/test-services-1.1.0.apk # Name of the test Session -TestCycleName = 27Sep-ESP +TestCycleName = pcloudyUtility #List of suites that you want to run (In Quotes and Comma Separated) Suites = com.checkmytrip.integration.data.TestSuiteNre diff --git a/Java/EspressOrchProject/lib/config.properties b/Java/EspressOrchProject/lib/config.properties index b8a21fdb..5ba9628d 100644 --- a/Java/EspressOrchProject/lib/config.properties +++ b/Java/EspressOrchProject/lib/config.properties @@ -21,19 +21,19 @@ DurationInMinutes = 10 DeviceIds = 42 # Location of the Application you want to test in your local machine -ApkFilePath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/pCloudyVector.apk +ApkFilePath = /home/pCloudyVector.apk # Location of the test APK in your local machine -TestApkPath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/pCloudyVectorTest.apk +TestApkPath = /home/pCloudyVectorTest.apk # Location of the Orchestrator APK -OrchstratorApkPath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/orchestrator-1.1.0.apk +OrchstratorApkPath = /home/orchestrator-1.1.0.apk # Location of the service APK -ServiceApkPath = /home/radmin/Desktop/ClientWork/Amedus_work/EspOrch/test-services-1.1.0.apk +ServiceApkPath = /home/test-services-1.1.0.apk # Name of the test Session -TestCycleName = 27Sep-ESP +TestCycleName = pcloudyUtility #List of suites that you want to run (In Quotes and Comma Separated) Suites = com.checkmytrip.integration.data.TestSuiteNre