简体   繁体   English

如何使用XML对象存储库进行Android并行测试执行

[英]How to use xml object repository for android parallel test execution

I am trying for Parallel Execution of My Selenium Test code on 2 Android devices . 我正在尝试在2个Android设备上并行执行“我的硒测试”代码。 Object Repository - XML Device - Android Real device Appium version - 1.13 Java-client - 6.0.0 对象存储库-XML设备-Android Real设备Appium版本-1.13 Java客户端-6.0.0

When running test in parallel mode , App launching on both device, after that when i am trying to access element , on 1st device able to access and test proceed , but in second device appium not able to find the elements. 在并行模式下运行测试时,App在两个设备上启动,此后,当我尝试访问element时,在能够访问和测试的第一个设备上继续进行,但是在第二个设备appium中找不到元素。 and test fail in 2nd device by saying not able to locate element . 通过说无法定位元素,并在第二个设备中测试失败。

if i run test as a single test , it pass on both device , but fail in parallel mode. 如果我将测试作为单个测试运行,它将在两个设备上均通过,但在并行模式下将失败。

is there any issue of accessing element from xml in parallel mode . 在并行模式下从xml访问元素有任何问题吗?

please suggest how to use object repository in parallel mode 请建议如何在并行模式下使用对象存储库

Most probably you haven't applied ThreadLocal Storage pattern to your AndroidDriver instances. 很可能您没有将ThreadLocal Storage模式应用于AndroidDriver实例。 You should be storing AndroidDriver under ThreadLocal something like: 您应该将AndroidDriver存储在ThreadLocal下,例如:

ThreadLocal<AndroidDriver> driver = new ThreadLocal<>();
// initialize AndroidDriver normally
driver.set(new AndroidDriver(new URL("http://url-of-your-appium-server"),capabilities));

and whenever you need to refer the AndroidDriver - do it like: 以及每当您需要引用AndroidDriver时,请执行以下操作:

driver.get().findElements....

More information: 更多信息:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM