简体   繁体   English

使用driver.quit()并行运行Appium测试时,导致其他测试失败

[英]When running Appium tests in parallel using driver.quit() causes the other test(s) to fail

The problem 问题

I am using Java to run JUnit test's in parallel to Appium servers configured with different ports and UUID's for each device. 我正在使用Java与为每个设备配置了不同端口和UUID的Appium服务器并行运行JUnit测试。 I am running the same test on both phones. 我在两部手机上都运行相同的测试。 It looks like when the test ends on the first phone it somehow interferes with the other phone which is still processing the same test. 当测试在第一部手机上结束时,它似乎以某种方式干扰了仍在处理同一测试的另一部手机。 This results in the error message and stack trace shown below. 这将导致错误消息和堆栈跟踪,如下所示。

This does NOT happen every time. 这并非每次都会发生。 It seems like most of the time the problem occurs but sometimes it will run a test on both without an issue. 似乎在大多数情况下都会出现问题,但有时它将对两者进行测试而不会出现问题。

driver.quit()/close() As part of the tests we close out the driver at the end using driver.quit() . driver.quit()/ close()作为测试的一部分,我们最后使用driver.quit()关闭了驱动程序。 Doing this causes the behaviour described above. 这样做会导致上述行为。 If I REMOVE driver.quit() all the tests will finish successfully. 如果我删除 driver.quit()所有测试将成功完成。 The problem with this is that if I want to run other tests the driver session is still open in Appium and there is no way to close it unless I restart Appium . 问题是如果我要运行其他测试,则驱动程序会话仍在Appium打开,除非我重新启动Appium ,否则无法关闭它。

Each JUnit test is run on its on Appium port and using the UUID of the device. 每个JUnit测试都在其Appium端口上并使用设备的UUID运行。

Environment 环境

  • Appium version (or git revision) that exhibits the issue: Appium v1.5.3 / Appium Java Client 4.0.0 / Appium 3.4.1 出现该问题的Appium版本(或git版本):Appium v​​1.5.3 / Appium Java Client 4.0.0 / Appium 3.4.1

Details 细节

2 Different errors: 1: 2种不同的错误:1:
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. org.openqa.selenium.WebDriverException:处理命令时发生未知的服务器端错误。 Original error: Android bootstrap socket crashed: Error: This socket has been ended by the other party (WARNING: The server did not provide any stacktrace information) 原始错误:Android引导程序套接字崩溃:错误:此套接字已由另一方终止(警告:服务器未提供任何堆栈跟踪信息)

2: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. 2:org.openqa.selenium.WebDriverException:处理命令时发生未知的服务器端错误。 Original error: Could not proxy. 原始错误:无法代理。 Proxy error: Could not proxy command to remote server. 代理错误:无法将命令代理到远程服务器。 Original error: Error: socket hang up (WARNING: The server did not provide any stacktrace information) 原始错误:错误:套接字挂起(警告:服务器未提供任何堆栈跟踪信息)

You will need to provide a different --bootstrap-port (-bp) for each Appium session as well. 您还需要为每个Appium会话提供一个不同的--bootstrap-port (-bp)。 Source: http://appium.io/slate/en/master/?java#parallel-android-tests Edit: documentation for parallel testing is these days found at http://appium.io/docs/en/advanced-concepts/parallel-tests/ 来源: http : //appium.io/slate/en/master/? java#parallel- android-tests编辑:并行测试文档可在以下网站找到: http://appium.io/docs/en/advanced-concepts /并行测试/

Also, if your parallel tests include usage of Selendroid automation or Chrome/WebView automation, further ports are needed for those: 另外,如果您的并行测试包括使用Selendroid自动化或Chrome / WebView自动化,则这些还需要其他端口:

--chromedriver-port the chromedriver port (if using webviews or chrome) --chromedriver-port chromedriver端口(如果使用webviews或chrome)

--selendroid-port the selendroid port (if using selendroid) --selendroid-port selendroid端口(如果使用selendroid)

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

相关问题 运行并行测试时如何使用 driver.quit() - How to use driver.quit() when running parallel tests driver.quit()导致'Firefox停止工作' - driver.quit() causes 'Firefox to stop working' Jenkins使用chromedriver运行Selenium UI测试无法按预期方式运行,driver.quit有时不起作用 - Jenkins run selenium UI tests using chromedriver not work as expected, driver.quit sometimes doesn't work 无法使用driver.quit关闭其他浏览器的实例 - Not able to close instances of different browser using driver.quit NoSuchSessionException会话ID为null。 调用quit()后使用WebDriver吗? 并行运行Java测试时 - NoSuchSessionException Session ID is null. Using WebDriver after calling quit()? when running the java tests in parallel 使用 TestNG、Appium 和 Selenium 运行并行和顺序测试 - Running parallel and sequential tests using TestNG, Appium and Selenium 硒RC“ driver.quit()”引发错误 - Selenium RC “driver.quit()” throwing error driver.quit()之后如何不关闭应用程序 - How not close application after driver.quit() Selenium + Gradle + Testng,driver.quit()上出现UnsatisfiedLinkError - Selenium + gradle + testng, UnsatisfiedLinkError on driver.quit() java Selenium driver.quit() 被忽略 - java Selenium driver.quit() is ignored
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM