Hi, I am using selenium grip in appium and connected two device with my project by everytime whenever run testNG.xml only one test run and other test skips…and the case that skip is of that device whose appium server run in the last. Please suggest me what to do and where I have to change.
Details are here:
TestNG xml-
Code
public class testing {
static AppiumDriver driver;
@Parameters({ "device","version" })
@BeforeClass
public void setup(String device,String version) throws IOException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appPackage", "com.android.settings");
capabilities.setCapability("appActivity", ".Settings");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,
"Android");
capabilities
.setCapability(MobileCapabilityType.PLATFORM_VERSION,version);
capabilities.setCapability("udid", device);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,
"Micromax");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),
capabilities);
}
@AfterClass
public void teardown() throws IOException {
driver.quit();
}
@Test()
public void Call() throws Exception {
Thread.sleep(2000);
System.out.println("end call");
}
public static AppiumDriver getdriver() {
return driver;
}
}
output of testNG:
…
… TestNG 6.9.11 by Cédric Beust ([email protected])
…
[TestNG] Running:
E:\Project\Eclipse\AppiumForWeb\testng.xml
[ThreadUtil] Starting executor timeOut:2147483647ms workers:2 threadPoolSize:5
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\AppiumForWeb\App2 Under Test .html
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\AppiumForWeb exists: true
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\AppiumForWeb\App2 Under Test .xml
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\AppiumForWeb exists: true
FAILED CONFIGURATION: @BeforeClass setup(“c65368bf”, “5.0.2”)
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Requested a new session but one was in progress) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 447 milliseconds
Build info: version: ‘2.48.2’, revision: ‘41bccdd’, time: ‘2015-10-09 19:59:12’
System info: host: ‘SANDY-PC’, ip: ‘192.168.0.109’, os.name: ‘Windows 7’, os.arch: ‘x86’, os.version: ‘6.1’, java.version: ‘1.8.0_91’
Driver info: io.appium.java_client.android.AndroidDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:156)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:109)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:39)
at testing.setup(testing.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:216)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:143)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:178)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:778)
at org.testng.TestRunner.run(TestRunner.java:632)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:39)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:400)
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
SKIPPED CONFIGURATION: @AfterClass teardown
SKIPPED: Call
===============================================
App2 Under Test
Tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1
end call
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\AppiumForWeb\App1 Under Test .html
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\AppiumForWeb exists: true
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\AppiumForWeb\App1 Under Test .xml
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\AppiumForWeb exists: true
PASSED: Call
===============================================
App1 Under Test
Tests run: 1, Failures: 0, Skips: 0
===============================================
AppiumForWeb
Total tests run: 2, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 1
[TestNG] Time taken by org.testng.reporters.XMLReporter@1698539: 40 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@ba2a48: 45 ms
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\junitreports\TEST-testing.xml
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\junitreports exists: true
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@616ca2: 14 ms
[Utils] Problem creating output directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb\toc.html
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb exists: true
[Utils] Problem creating output directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb\App2 Under Test .properties
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb exists: true
[Utils] Problem creating output directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb\App1 Under Test .properties
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb exists: true
[Utils] Problem creating output directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb\index.html
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb exists: true
[Utils] Problem creating output directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb\main.html
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb exists: true
[Utils] Problem creating output directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb\groups.html
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb exists: true
[Utils] Problem creating output directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb
[Utils] Problem creating output directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb
[Utils] Problem creating output directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb\classes.html
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb exists: true
[Utils] Problem creating output directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb\reporter-output.html
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb exists: true
[Utils] Problem creating output directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb\methods-not-run.html
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb exists: true
[Utils] Problem creating output directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb\testng.xml.html
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\old\AppiumForWeb exists: true
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\old\index.html
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\old exists: true
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@f71333: 128 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@3498ed: 137 ms
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\testng-failed.xml
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output exists: true
[Utils] Attempting to create E:\Project\Eclipse\AppiumForWeb\test-output\AppiumForWeb\testng-failed.xml
[Utils] Directory E:\Project\Eclipse\AppiumForWeb\test-output\AppiumForWeb exists: true
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 263 ms
node1.js:
{
“capabilities”:
[
{
“browserName”: “Android”,
“version”:“5.1”,
“udid”:“0123456789ABCDEF”,
“maxInstances”: 1,
“platform”:“ANDROID”,
“deviceName”:“Device”
}],
“configuration”:
{
“cleanUpCycle”:2000,
“timeout”:10000,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“url”:“http://0.0.0.0:4723/wd/hub”,
“maxSession”: 5,
“port”: 4723,
“host”: “0.0.0.0”,
“register”: true,
“registerCycle”: 5000,
“hubPort”: 4444,
“hubHost”: “localhost”
}
}
node2.js:
{
“capabilities”:
[
{
“browserName”: “Android”,
“version”:“5.0.2”,
“udid”:“c65368bf”,
“maxInstances”: 1,
“platform”:“ANDROID”,
“deviceName”:“Device”
}],
“configuration”:
{
“cleanUpCycle”:2000,
“timeout”:10000,
“proxy”: “org.openqa.grid.selenium.proxy.DefaultRemoteProxy”,
“url”:“http://0.0.0.0:4724/wd/hub”,
“maxSession”: 5,
“port”: 4724,
“host”: “0.0.0.0”,
“register”: true,
“registerCycle”: 5000,
“hubPort”: 4444,
“hubHost”: “localhost”
}
}
commands for appium server:
node.exe node_modules\appium\bin\appium.js --nodeconfig E:\Project\Eclipse\AppiumForWeb\node1.json -p 4723 –U 0123456789ABCDEF
node.exe node_modules\appium\bin\appium.js --nodeconfig E:\Project\Eclipse\AppiumForWeb\node2.json -p 4724 –U c65368bf