尝试单击单选按钮时如何解决Robo测试失败?

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

我有一个机器人脚本来指导机器人测试实验室。但是在进行自动测试时总是会出错,单击单选按钮

我读取action.json,logcat,并从测试结果中观看视频。它告诉我机器人测试可以从27通过24个步骤

来自测试结果中的actions.json

{
    "sequence": 29,
    "sourceScreenId": "14",
    "destinationScreenId": "14",
    "startTimeSeconds": 81.355,
    "endTimeSeconds": 81.442,
    "executionResult": "FAILED",
    "isRoboscriptActive": true,
    "target": {
      "type": "TAP",
      "childSequence": "0.0.1.0.1.0.0.0.1.0.2.0.6",
      "targetDetails": {
        "componentType": "BUTTON",
        "resourceName": "id.tumbasin.app.debug:id/radioBankTransfer",
        "className": "androidx.appcompat.widget.AppCompatRadioButton",
        "androidClassName": "android.widget.RadioButton"
      }
    }
  }, {
    "startTimeSeconds": 81.442,
    "endTimeSeconds": 81.442,
    "roboscriptFinished": {
      "reason": "ACTION_FAILED"
    }
  }

机器人脚本

{
    "eventType": "VIEW_CLICKED",
    "timestamp": 1571809883185,
    "replacementText": "",
    "actionCode": -1,
    "delayTime": 0,
    "canScrollTo": false,
    "elementDescriptors": [
      {
        "className": "androidx.appcompat.widget.AppCompatRadioButton",
        "recyclerViewChildPosition": -1,
        "adapterViewChildPosition": -1,
        "groupViewChildPosition": 6,
        "resourceId": "id.tumbasin.app.debug:id/radioBankTransfer",
        "contentDescription": "",
        "text": ""
      },
      {
        "className": "androidx.constraintlayout.widget.ConstraintLayout",
        "recyclerViewChildPosition": -1,
        "adapterViewChildPosition": -1,
        "groupViewChildPosition": 0,
        "resourceId": "",
        "contentDescription": "",
        "text": ""
      },
      {
        "className": "androidx.cardview.widget.CardView",
        "recyclerViewChildPosition": -1,
        "adapterViewChildPosition": -1,
        "groupViewChildPosition": 2,
        "resourceId": "id.tumbasin.app.debug:id/cardPayment",
        "contentDescription": "",
        "text": ""
      }
    ]
  },

来自logcat

Caused by: androidx.test.espresso.PerformException: Error performing 'single click' on view '(with class name: is "androidx.appcompat.widget.AppCompatRadioButton" and with id: id.tumbasin.app.debug:id/radioBankTransfer and is a child at 6th index of the matching parent: (with class name: is "androidx.constraintlayout.widget.ConstraintLayout" and with id: 1 (resource name not found) and is a child at 0th index of the matching parent: (with class name: is "androidx.cardview.widget.CardView" and with id: id.tumbasin.app.debug:id/cardPayment and is a child at 2th index of the matching parent: (with class name: is "androidx.constraintlayout.widget.ConstraintLayout" and with id: 1 (resource name not found) and is a child at 0th index of the matching parent: (with class name: is "androidx.core.widget.NestedScrollView" and with id: id.tumbasin.app.debug:id/scrollViewOrder and is a child at 1th index of the matching parent: (with class name: is "androidx.constraintlayout.widget.ConstraintLayout" and with id: 1 (resource name not found) and is a child at 0th index of the matching parent: (with class name: is "android.widget.FrameLayout" and with id: id.tumbasin.app.debug:id/nav_host_fragment and is a child at 0th index of the matching parent: (with class name: is "androidx.constraintlayout.widget.ConstraintLayout" and with id: id.tumbasin.app.debug:id/container and is a child at 0th index of the matching parent: (with class name: is "androidx.appcompat.widget.ContentFrameLayout" and with id: android:id/content and is a child at 1th index of the matching parent: (with class name: is "androidx.appcompat.widget.FitWindowsLinearLayout" and with id: id.tumbasin.app.debug:id/action_bar_root and is a child at 0th index of the matching parent: (with class name: is "android.widget.FrameLayout" and with id: 1 (resource name not found) and is a child at 1th index of the matching parent: (with class name: is "android.widget.LinearLayout" and with id: 1 (resource name not found) and is a child at 0th index of the matching parent: (with class name: is "com.android.internal.policy.DecorView" and with id: 1 (resource name not found) and is a root view.)))))))))))))'.
android firebase-test-lab
1个回答
0
投票

看起来Robo正确找到了要执行点击操作的元素,但是在Espresso本身内部点击失败。需要更多的上下文信息来理解Espresso为什么无法单击此单选按钮,例如,单选按钮是否完全可见等。日志中是否还有其他与此异常相关的内容,可能会使根源更加明了问题的原因?

[另外,您可以在Android Studio中使用Espresso Test Recorder(运行|记录Espresso测试)来为与您录制Roboscript完全相同的动作记录一次Espresso测试。然后,通过运行此Espresso测试,您可以检查同一操作是否失败,如果失败,则错误消息将包含更多上下文信息。

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