我需要在android-kotlin中使用espresso为无线电组编写测试用例,下面是我用过的xml。
<RadioGroup
android:id="@+id/radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp"
android:checkedButton="@+id/production"
tools:ignore="MissingConstraints">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/env_select"
android:textStyle="bold"
android:textSize="20sp"
/>
<RadioButton
android:id="@+id/production"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/env_production"
/>
<RadioButton
android:id="@+id/development"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/env_development"
/>
<RadioButton
android:id="@+id/testing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/env_testing"
/>
</RadioGroup>
我试过一些代码
onView(withId(R.id.production))
.check(matches(isChecked()));
onView(withId(R.id.development))
.check(matches(not(isChecked())));
onView(withId(R.id.testing))
.check(matches(not(isChecked())));
但它显示为android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id:production
请帮我写相同的测试用例
• 我正在编写一个 verilog 测试台,我想检查我正在测试台中测试的模块中的内部电线的值
• 如何在 Protractor 中读取和写入 excel?
• 如何在Espresso中做一个测试,检查包含HTML标签的字符串?
• 在 python 中进行 Squish 测试以测试 qt 应用程序
• How to Write unit test for Host.defaultbuilder in c#
• H2 数据库中的 POST 和 GET 操作,同时在 Springboot 中进行集成测试用例
• 外部服务测试用例因 - NSubstitute.Exceptions.CouldNotSetReturnDueToNoLastCallException 无法找到返回的调用而失败
• Android UIAutomator:如何在 UI 测试中获取当前运行的测试方法的名称
• 为 XMLHttpRequest 编写 JavaScript 测试