Appium:超慢的Robot Framework自动化测试(小米)

问题描述 投票:0回答:1

我有一个简单的测试应用程序(react-native),带有一些按钮,可以调用 toast 消息。我在 Robot Framework 中编写了简单的测试用例,单击各个按钮,然后等待 toast 显示。

直到上周一切都进展顺利。测试变得“慢得无法使用”(每次交互都花费太多时间)。通常,点击一次需要花费一两秒,现在可能需要长达一分钟。只有启动初始连接和应用程序启动正常。 我正在本地计算机(Mac)上使用真实设备(小米)运行测试。

设置:

    Appium:1.22.2
  • 机器人框架 4.1.3(达尔文上的 Python 3.9.10)
  • MacOS 12.2.1
  • 手机:小米红米Note 7
  • 安卓:10
    • MIUI:12.5.3
当我在
不同的设备

(三星)上运行测试时,它工作得很好。 (使用其他设备不是解决方案,该设备不是我的)

这是我的
Suite Setup

***Keywords***
Start App
    &{deviceConfig}=  Create Dictionary
    Set To Dictionary  ${deviceConfig}  platformName=android
    Set To Dictionary  ${deviceConfig}  platformVersion=10
    Set To Dictionary  ${deviceConfig}  udid=c15dded3
    Set To Dictionary  ${deviceConfig}  appPackage=com.toastexamplestest
    Set To Dictionary  ${deviceConfig}  appActivity=.MainActivity
    Set To Dictionary  ${deviceConfig}  automationName=uiautomator2

    Open Application  http://127.0.0.1:4723/wd/hub  &{deviceConfig}

这是测试用例之一:

React native root toast Tap ${btn_root_toast} Wait For Error //android.view.ViewGroup/android.widget.TextView[contains(@text, '${toast_text_root_toast}' )] Sleep 5s Tap ${btn_root_toast} Wait For Error //android.view.ViewGroup/android.widget.TextView[contains(@text, '${toast_text_root_toast}' )]

Wait For Error

只是

Wait Until Page Contains Element
的包装)

测试设置

只是Launch Application

测试拆解
只是Quit Application
Appium 日志:

[Appium] Appium REST http interface listener started on 0.0.0.0:4723 ... [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided [BaseDriver] Creating session with W3C capabilities: { [BaseDriver] "alwaysMatch": { [BaseDriver] "platformName": "android", [BaseDriver] "appium:platformVersion": "10", [BaseDriver] "appium:udid": "c15dded3", [BaseDriver] "appium:appPackage": "com.toastexamplestest", [BaseDriver] "appium:appActivity": ".MainActivity", [BaseDriver] "appium:automationName": "uiautomator2" [BaseDriver] }, [BaseDriver] "firstMatch": [ [BaseDriver] {} [BaseDriver] ] [BaseDriver] } [BaseDriver] Session created with session id: d97552ab-31db-42f1-b98d-d23549f2efde [UiAutomator2] Starting 'com.toastexamplestest' directly on the device [ADB] Using 'adb' from '/Users/marekd/Library/Android/sdk/platform-tools/adb' ... [ADB] Connected devices: [{"udid":"c15dded3","state":"device"}] [AndroidDriver] Using device: c15dded3 ... [WD Proxy] socket hang up [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8200/wd/hub/status] with no body [WD Proxy] socket hang up [Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server: [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8200/wd/hub/status] with no body [WD Proxy] socket hang up [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8200/wd/hub/status] with no body [WD Proxy] Got response with status 200: {"sessionId":"None","value":{"message":"UiAutomator2 Server is ready to accept commands","ready":true}} [UiAutomator2] The initialization of the instrumentation process took 3080ms ... [HTTP] <-- POST /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/appium/app/launch 200 963 ms - 14 [HTTP] [HTTP] --> POST /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/elements [HTTP] {"using":"xpath","value":"//android.widget.Button[1]"} [W3C (d97552ab)] Calling AppiumDriver.findElements() with args: ["xpath","//android.widget.Button[1]","d97552ab-31db-42f1-b98d-d23549f2efde"] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, css selector, -android uiautomator [BaseDriver] Waiting up to 0 ms for condition [WD Proxy] Matched '/elements' to command name 'findElements' [WD Proxy] Proxying [POST /elements] to [POST http://127.0.0.1:8200/wd/hub/session/cae5d25f-d594-4ec4-90de-bbc34238a12a/elements] with body: {"strategy":"xpath","selector":"//android.widget.Button[1]","context":"","multiple":true} [WD Proxy] Got response with status 200: {"sessionId":"cae5d25f-d594-4ec4-90de-bbc34238a12a","value":[{"ELEMENT":"00000000-0000-0049-ffff-ffff00000011","element-6066-11e4-a52e-4f735466cecf":"00000000-0000-0049-ffff-ffff00000011"}]} [W3C (d97552ab)] Responding to client with driver.findElements() result: [{"element-6066-11e4-a52e-4f735466cecf":"00000000-0000-0049-ffff-ffff00000011","ELEMENT":"00000000-0000-0049-ffff-ffff00000011"}] [HTTP] <-- POST /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/elements 200 10355 ms - 139 [HTTP] [HTTP] --> POST /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/touch/perform [HTTP] {"actions":[{"action":"tap","options":{"element":"00000000-0000-0049-ffff-ffff00000011","count":1}}]} [W3C (d97552ab)] Calling AppiumDriver.performTouch() with args: [[{"action":"tap","options":{"element":"00000000-0000-0049-ffff-ffff00000011","count":1}}],"d97552ab-31db-42f1-b98d-d23549f2efde"] [UiAutomator2] calling get location: 00000000-0000-0049-ffff-ffff00000011 [WD Proxy] Matched '/element/00000000-0000-0049-ffff-ffff00000011/location' to command name 'getLocation' [WD Proxy] Proxying [GET /element/00000000-0000-0049-ffff-ffff00000011/location] to [GET http://127.0.0.1:8200/wd/hub/session/cae5d25f-d594-4ec4-90de-bbc34238a12a/element/00000000-0000-0049-ffff-ffff00000011/location] with no body [WD Proxy] Got response with status 200: {"sessionId":"cae5d25f-d594-4ec4-90de-bbc34238a12a","value":{"x":11,"y":832}} [WD Proxy] Matched '/element/00000000-0000-0049-ffff-ffff00000011/size' to command name 'getSize' [WD Proxy] Proxying [GET /element/00000000-0000-0049-ffff-ffff00000011/size] to [GET http://127.0.0.1:8200/wd/hub/session/cae5d25f-d594-4ec4-90de-bbc34238a12a/element/00000000-0000-0049-ffff-ffff00000011/size] with no body [WD Proxy] Got response with status 200: {"sessionId":"cae5d25f-d594-4ec4-90de-bbc34238a12a","value":{"height":97,"width":1058}} [WD Proxy] Proxying [POST /appium/tap] to [POST http://127.0.0.1:8200/wd/hub/session/cae5d25f-d594-4ec4-90de-bbc34238a12a/appium/tap] with body: {"x":540,"y":880.5,"undefined":null} [WD Proxy] Got response with status 200: {"sessionId":"cae5d25f-d594-4ec4-90de-bbc34238a12a","value":null} [W3C (d97552ab)] Responding to client with driver.performTouch() result: null [HTTP] <-- POST /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/touch/perform 200 50417 ms - 14 [HTTP] [HTTP] --> POST /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/elements [HTTP] {"using":"xpath","value":"//android.view.ViewGroup/android.widget.TextView[contains(@text, 'This is a message' )]"} [W3C (d97552ab)] Calling AppiumDriver.findElements() with args: ["xpath","//android.view.ViewGroup/android.widget.TextView[contains(@text, 'This is a message' )]","d97552ab-31db-42f1-b98d-d23549f2efde"] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, css selector, -android uiautomator [BaseDriver] Waiting up to 0 ms for condition [WD Proxy] Matched '/elements' to command name 'findElements' [WD Proxy] Proxying [POST /elements] to [POST http://127.0.0.1:8200/wd/hub/session/cae5d25f-d594-4ec4-90de-bbc34238a12a/elements] with body: {"strategy":"xpath","selector":"//android.view.ViewGroup/android.widget.TextView[contains(@text, 'This is a message' )]","context":"","multiple":true} [WD Proxy] Got response with status 200: {"sessionId":"cae5d25f-d594-4ec4-90de-bbc34238a12a","value":[]} [W3C (d97552ab)] Responding to client with driver.findElements() result: [] [HTTP] <-- POST /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/elements 200 10093 ms - 12 [HTTP] [HTTP] --> POST /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/elements [HTTP] {"using":"xpath","value":"//android.view.ViewGroup/android.widget.TextView[contains(@text, 'This is a message' )]"} [W3C (d97552ab)] Calling AppiumDriver.findElements() with args: ["xpath","//android.view.ViewGroup/android.widget.TextView[contains(@text, 'This is a message' )]","d97552ab-31db-42f1-b98d-d23549f2efde"] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, css selector, -android uiautomator [BaseDriver] Waiting up to 0 ms for condition [WD Proxy] Matched '/elements' to command name 'findElements' [WD Proxy] Proxying [POST /elements] to [POST http://127.0.0.1:8200/wd/hub/session/cae5d25f-d594-4ec4-90de-bbc34238a12a/elements] with body: {"strategy":"xpath","selector":"//android.view.ViewGroup/android.widget.TextView[contains(@text, 'This is a message' )]","context":"","multiple":true} [WD Proxy] Got response with status 200: {"sessionId":"cae5d25f-d594-4ec4-90de-bbc34238a12a","value":[]} [W3C (d97552ab)] Responding to client with driver.findElements() result: [] [HTTP] <-- POST /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/elements 200 10083 ms - 12 [HTTP] [HTTP] --> GET /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/source [HTTP] {} [W3C (d97552ab)] Driver proxy active, passing request on via HTTP proxy [WD Proxy] Matched '/wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/source' to command name 'getPageSource' [WD Proxy] Proxying [GET /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/source] to [GET http://127.0.0.1:8200/wd/hub/session/cae5d25f-d594-4ec4-90de-bbc34238a12a/source] with no body [WD Proxy] Got response with status 200: {"sessionId":"cae5d25f-d594-4ec4-90de-bbc34238a12a","value":"\r\n\r\n \r\n \r\n [WD Proxy] Replacing sessionId cae5d25f-d594-4ec4-90de-bbc34238a12a with d97552ab-31db-42f1-b98d-d23549f2efde [HTTP] <-- GET /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/source 200 10186 ms - 10712 [HTTP] [HTTP] --> GET /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/screenshot [HTTP] {} [W3C (d97552ab)] Calling AppiumDriver.getScreenshot() with args: ["d97552ab-31db-42f1-b98d-d23549f2efde"] [WD Proxy] Matched '/screenshot' to command name 'getScreenshot' [WD Proxy] Proxying [GET /screenshot] to [GET http://127.0.0.1:8200/wd/hub/session/cae5d25f-d594-4ec4-90de-bbc34238a12a/screenshot] with no body [WD Proxy] Got response with status 200: {"sessionId":"cae5d25f-d594-4ec4... [W3C (d97552ab)] Responding to client with driver.getScreenshot() result: "iVBORw0K... [HTTP] <-- GET /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/screenshot 200 608 ms - 140626 [HTTP] [HTTP] --> POST /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/appium/app/close [HTTP] {} [W3C (d97552ab)] Calling AppiumDriver.closeApp() with args: ["d97552ab-31db-42f1-b98d-d23549f2efde"] [ADB] Running '/Users/marekd/Library/Android/sdk/platform-tools/adb -P 5037 -s c15dded3 shell am force-stop com.toastexamplestest' [W3C (d97552ab)] Responding to client with driver.closeApp() result: null [HTTP] <-- POST /wd/hub/session/d97552ab-31db-42f1-b98d-d23549f2efde/appium/app/close 200 86 ms - 14

日志不完整,无法全部放在这里。

android performance appium robotframework
1个回答
0
投票

© www.soinside.com 2019 - 2024. All rights reserved.