我试图在单个设备上通过testNG在Appium上逐个运行多个测试用例

时间:2016-07-29 11:41:28

标签: java eclipse testng appium

我的第一个测试用例成功运行,但在第二个测试用例中。我收到以下错误:

  

org.openqa.selenium.SessionNotCreatedException:无法创建新会话。详细信息:获取驱动程序类型的会话数据时出现问题

     

AndroidDriver;它实现'get driverData'吗? (警告:服务器未提供任何堆栈跟踪信息)   命令持续时间或超时:10毫秒

     

构建信息:版本:'2.53.0',修订版:'35ae25b1534ae328c771e0856c93e187490ca824',时间:'2016-03-15 10:43:46'   系统信息:主机:'abhishek-Aspire-E1-572',ip:'127.0.1.1',os.name:'Linux',os.arch:'amd64',os.version:'3.19.0-56- generic',java.version:'1.8.0_77'

     

驱动程序信息:io.appium.java_client.android.AndroidDriver

分享我的能力,如下所示: -

fixture_channel_join

共享Testng.xml套件: -

AndroidDriver<MobileElement> d = null;
DesiredCapabilities cap = new DesiredCapabilities();
if(remoteExecution.equalsIgnoreCase("true")){
if (browser.equals("samsung")) {
        System.out.println(browser);
        cap = DesiredCapabilities.android();
        cap.setCapability(MobileCapabilityType.BROWSER_NAME, "");
        cap.setCapability(MobileCapabilityType.DEVICE_NAME, "4d00b83ed4f7426f");  
        //cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 30);
        cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
        cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, "5.0.1");
        cap.setCapability("autoAcceptAlerts", Boolean.TRUE);
        cap.setCapability("waitForAppScript", Boolean.TRUE);
        cap.setCapability("noReset",Boolean.TRUE);
        cap.setCapability(MobileCapabilityType.APP_PACKAGE, "com.rentitbae");
        cap.setCapability(MobileCapabilityType.APP_ACTIVITY, "com.rentitbae.MainActivity");


    } else if (browser.equals("micromax")) {
        System.out.println(browser);
        cap = DesiredCapabilities.android();
        cap.setCapability(MobileCapabilityType.BROWSER_NAME, "");
        cap.setCapability(MobileCapabilityType.DEVICE_NAME, "0123456789ABCDEF");  
        cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 60);
        cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
        cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, "4.4.2");
        cap.setCapability("autoAcceptAlerts", Boolean.TRUE);
        cap.setCapability("waitForAppScript", Boolean.TRUE);
        cap.setCapability(MobileCapabilityType.APP_PACKAGE, "com.rentitbae");
        cap.setCapability(MobileCapabilityType.APP_ACTIVITY, "com.rentitbae.MainActivity");

    } else if (browser.equals("jelly beans")) {
        System.out.println(browser);
        cap = DesiredCapabilities.android();
        cap.setCapability(MobileCapabilityType.BROWSER_NAME, "");
        cap.setCapability(MobileCapabilityType.DEVICE_NAME, "192.168.56.101:5555");  
        cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 60);
        cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
        cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, "4.2.2");
        cap.setCapability("autoAcceptAlerts", Boolean.TRUE);
        cap.setCapability("waitForAppScript", Boolean.TRUE);
        cap.setCapability(MobileCapabilityType.APP_PACKAGE, "com.rentitbae");
        cap.setCapability(MobileCapabilityType.APP_ACTIVITY, "com.rentitbae.MainActivity");

    }
}

    URL url = new URL(gridHubRemoteUrl);
    System.out.println(cap.getBrowserName());
    d = new AndroidDriver<MobileElement>(url, cap);
return d;
}

config.property文件: -

<?xml version="1.0" encoding="UTF-8"?>
    <suite name="Suite">
        <test name="Tests">
            <classes>
                <class name="android_rib.VerifyLoginFBTest"/>
                <class name="android_rib.VerifyLoginGmailTest"/>
            </classes>
        </test>
    </suite>

0 个答案:

没有答案