Best Testsigma code snippet using com.testsigma.agent.tasks.TestPlanRunTask.setAppiumUrl
Source:TestPlanRunTask.java
...61 log.info("Setting up local mobile device");62 try {63 checkDeviceAvailability();64 TestDeviceSettings testDeviceSettings = environment.getEnvSettings();65 setAppiumUrl(testDeviceSettings);66 testDeviceSettings.setDeviceName(mobileDevice.getName());67 testDeviceSettings.setDeviceUniqueId(mobileDevice.getUniqueId());68 if (Platform.Android.equals(getEnvPlatform())) {69 testDeviceSettings.setChromedriverExecutableDir(PathUtil.getInstance().getDriversPath());70 } else if (Platform.iOS.equals(getEnvPlatform())) {71 iosDeviceService.setupWda(mobileDevice);72 }73 environment.setEnvSettings(testDeviceSettings);74 mobileAutomationServerService.installDrivers(this.mobileDevice.getOsName(), this.mobileDevice.getUniqueId());75 } catch (TestsigmaException | DeviceNotConnectedException | MobileLibraryInstallException e) {76 log.error(e.getMessage(), e);77 throw new AutomatorException(e.getMessage(), e);78 }79 }80 private void checkDeviceAvailability() throws DeviceNotConnectedException, TestsigmaException {81 mobileDevice = deviceContainer.getDevice(environment.getAgentDeviceUuid());82 if (this.mobileDevice == null || !this.mobileDevice.getIsOnline()) {83 environmentRunResult.setErrorCode(ErrorCodes.DEVICE_NOT_FOUND);84 environmentRunResult.setMessage(AutomatorMessages.getMessage(AutomatorMessages.DEVICE_NOT_FOUND, environment.getAgentDeviceUuid()));85 throw new DeviceNotConnectedException("Couldn't find device " + StringUtils.defaultString(environment.getAgentDeviceUuid(), "") + ". Check if it's online.");86 }87 }88 private void setAppiumUrl(TestDeviceSettings testDeviceSettings) {89 String appiumServerUrl = mobileAutomationServerService.getMobileAutomationServer().getServerURL();90 log.info("Appium url - " + appiumServerUrl);91 testDeviceSettings.setAppiumUrl(appiumServerUrl);92 }93 private Platform getEnvPlatform() {94 if (environment.getEnvSettings().getPlatform() == null)95 return Platform.Generic;96 return environment.getEnvSettings().getPlatform();97 }98}...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!