Hello
We are testing our Mobile App(Hybrid Application) with LeanFT and we have a bit of a problem.
Our IOS and Android App Object Recoqnition is quite a bit different. So we have to use two different AppModels even tough they have the same structur and same Objects. Just the object properties in the Identification are different.
The Problem now is that we have to write double the code for the same test, even tough everything is the same but the AppModel.
For example:
Device device = MobileLab.lockDeviceById("ID");
appModelBase = getAppModel();
if (master.getDevice().getOs().equals("IOS")) {
ApplicationModelIOS ios = (ApplicationModelIOS) appModelBase;
ios.MobileApp().launch();
} else{
ApplicationModelAndroid android = (ApplicationModelAndroid) appModelBase;
android.MobileApp().launch();
}
The getAppModel method:
public static AppModelBase getAppModel() throws GeneralLeanFtException {
if (master.getDevice().getOs().equals("IOS")) {
return new ApplicationModelIOS(device);
} else if (master.getDevice().getOs().equals("Android")) {
return new ApplicationModelAndroid(device);
} else {
throw new GeneralLeanFtException("Could not create Application Model. Make sure to set the the correct Device in the Excel.");
}
}
Is there anyway to reduce the lines of code? Should we create our own AppModel?
Thanks
Davor