I installed appium from npm and have I am running my test for android on 3 real devices. Using windows OS. My tests are written in java only.
Here is how i set up the three different devices. Each testng.xml will have a property which will specify the device number so each will be set up with different capabilities.
/**
* Sets up appium.
*/
@SuppressWarnings(“deprecation”)
@BeforeSuite(alwaysRun = true)
@Parameters(“deviceNumber”)
public void SetUpAppium(String deviceNumber) throws Exception {
DesiredCapabilities capabilities = new DesiredCapabilities();
if (deviceNumber.equals("1")) {
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "6.0.1");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "0815f8ab2d9c0f04");
capabilities.setCapability(MobileCapabilityType.UDID, "0815f8ab2d9c0f04");
capabilities.setCapability(MobileCapabilityType.APP_PACKAGE, "com.ztrip.debug");
capabilities.setCapability(MobileCapabilityType.APP_ACTIVITY,
"com.ztrip.refresh.activity.RegistrationActivity");
driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4923/wd/hub"), capabilities);
} else if (deviceNumber.equals("2")) {
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "6.0.1");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "32048bee42301293");
capabilities.setCapability(MobileCapabilityType.UDID, "32048bee42301293");
capabilities.setCapability(MobileCapabilityType.APP_PACKAGE, "com.ztrip.debug");
capabilities.setCapability(MobileCapabilityType.APP_ACTIVITY,
"com.ztrip.refresh.activity.RegistrationActivity");
driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4835/wd/hub"), capabilities);
} else if (deviceNumber.equals("3")) {
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "6.0.1");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "LGH8159ea5948a");
capabilities.setCapability(MobileCapabilityType.UDID, "LGH8159ea5948a");
capabilities.setCapability(MobileCapabilityType.APP_PACKAGE, "com.ztrip.debug");
capabilities.setCapability(MobileCapabilityType.APP_ACTIVITY,
"com.ztrip.refresh.activity.RegistrationActivity");
driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4747/wd/hub"), capabilities);
}
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.resetApp();
I am running three different appium servers with the following command
appium --address 127.0.0.1 -p 4923 -U 0815f8ab2d9c0f04 -bp 4945 --chromedriver-port 4977 --session-override
appium --address 127.0.0.1 -p 4835 -U 32048bee42301293 -bp 4857 --chromedriver-port 4877 --session-override
appium --address 127.0.0.1 -p 4747 -U LGH8159ea5948a -bp 4769 --chromedriver-port 4777 --session-override
Then i use testng to execute different test cases on each real device. However, 10 minutes into the test cases i get the following error on two of the servers. The third server contineus to work normally.
Error: Android bootstrap socket crashed: Error: read ECONNRESET
at Socket. (lib/bootstrap.js:87:21)
at Socket.emit (events.js:107:17)
at net.js:459:14
at process._tickCallback (node.js:355:11)
I have updated appium to latest version with npm update -g appium
Please help as I have been stuck on this issue for over a week. I believe there may be a bug where appium is not correctly forwarding the bootstrap port.