1Q.
When 3/4 AutoQA’s execute testcases at their convienant times by pulling the latest develop bitbucket code, they will obv have diff conf data as below
How to programmtically get the iOS Device & simulator udid (whatever they are executing on) - Java. Check the below code
public class BaseTest {
public static AppiumDriverLocalService service;
public static Properties prop = new Properties();
public static InputStream inputProperties = null;
public static DesiredCapabilities cap = null;
public static URL url = null;
public static IOSDriver driver=null;
public static IOSDriver setUp() {
try {
inputProperties = new FileInputStream(System.getProperty("user.dir") + "/device.properties");
prop.load(inputProperties);
cap = new DesiredCapabilities();
for(i=1; i<=5;i++)
{
if ((prop.getProperty("udid_'"+i+"'").equals(connected_Device_UDID)) && (prop.getProperty("deviceType'"+i+"'").equals("simulator")))
{
cap.setCapability("platformName", prop.getProperty("platformName'"+i+"'"));
cap.setCapability("deviceName", prop.getProperty("deviceName'"+i+"'"));
cap.setCapability("automationName", prop.getProperty("automationName'"+i+"'"));
cap.setCapability("udid", prop.getProperty("udid'"+i+"'"));
cap.setCapability("bundleId", prop.getProperty("bundleId'"+i+"'"));
driver = new IOSDriver(url, cap);
}
else if ((prop.getProperty("udid_'"+i+"'").equals(connected_Device_UDID)) && (prop.getProperty("deviceType'"+i+"'").equals("realDevice")))
{
cap.setCapability("platformName", prop.getProperty("platformName'"+i+"'"));
cap.setCapability("deviceName", prop.getProperty("deviceName'"+i+"'"));
cap.setCapability("automationName", prop.getProperty("automationName'"+i+"'"));
cap.setCapability("udid", prop.getProperty("udid'"+i+"'"));
cap.setCapability("xcodeOrgId", prop.getProperty("xcodeOrgId'"+i+"'"));
cap.setCapability("xcodeSigningId", prop.getProperty("xcodeSigningId'"+i+"'"));
cap.setCapability("bundleId", prop.getProperty("bundleId'"+i+"'"));
driver = new IOSDriver(url, cap);
}
}
} catch (IOException io) {
io.printStackTrace();
}
return driver;
}
Need to use this command: xcrun xctrace list devices in code & get the simulator / device udid as per the requirment.
Any other better simpler way to do the above stuff?
Q2:
Need to point to certain env before testing a scenario - iOS App(our company app). How this can be done programmatically.