How to retain session with appium when working on two diffrent devices

Hello,

I am running testcases on two diffrent devices where i had to keep 1 device idle for some time till another executing some thing.

As far as I understand, appium can not handle two sessions at a time. You may want to run two instances of appium server on two different ports and configure tests on each device to use these ports.

I agree with @RamS , you need to handle all two instaces using thread level programming.

i am running two appium instances on two diffrent ports. still the time the script is executing in first device the appium of second device sent kill command

i am doing the same, but not facing this issue… I am using java 1.7 's util.concurrent package to handle concurrent sessions.

can u help me in this …
These are mine capabilities
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“deviceName”,“Android”);
capabilities.setCapability(“device”, “Android”);

capabilities.setCapability(CapabilityType.VERSION,"4.4");
capabilities.setCapability("platformName","Android");

capabilities.setCapability("app",basePath+"\\Apps\\"+prop.getProperty("appName"));
capabilities.setCapability("udid",deviceId);
capabilities.setCapability(CapabilityType.PLATFORM, Platform.WINDOWS);
capabilities.setCapability("newCommandTimeout","500");
 return new AppiumDriver(new URL("http://127.0.0.1:"+Appiumport+"/wd/hub"), capabilities);

Though I have not tried it, I believe using the capability “newCommandTimeout” you can set wait time for next command in appium.
More details @ http://appium.io/slate/en/v1.0.0/?java#appium-server-capabilities

aliceTest = new AppTests("Alice");
bobTest = new AppTests("Bob");

aliceTest.installEnigma(); # [ That initialize web driver  for Alice]
bobTest.installEnigma();  #[ That initialize web driver  for Bob] 

Above both operation are sequential.

Collection<Callable<Void>> tasks = new ArrayList<Callable<Void>>();
            tasks.add(new Callable<Void>() {
                public Void call() throws Exception {
                    aliceTest.appWelcome();
                    return null;
                }
            );

            tasks.add(new Callable<Void>() {
                public Void call() throws Exception {
                    bobTest.appWelcome();
                    return null;
                }
            );
        }      

  
executorService.invokeAll(tasks); # [ This method run two session parallel, and wont quite untill both method execute successfully] 

So this is very high level approach. You need to customized this as per your requirement.

Thanks,
Priyank Shah

i already used newcommandtime but it is not working for me

seems it is a high level i am not understanding it properly!!

has anyone had any luck with Selenium Grid?

Watch my videos. May be it will help you to solve you issues of selenium grid