Android Espresso:带有输入类型编号的 EditText
Android Espresso: EditText with input type number
我想用 Espresso 测试我的 android 应用。我有一个 editText
和 android:inputType="number"
.
如果我在考试中这样写:
onView(withId(R.id.editTextNumber)).perform(typeText("15"));
没用。但由于 typeText 不接受整数,我该如何执行此测试?
谢谢:)
试试这个:
onView(withId(blabla)).peform(typeText(String.valueOf("15"));
https://google.github.io/android-testing-support-library/docs/espresso/advanced/index.html
如果找不到任何方法将数字输入到 EditText 中,则必须避免使用 typeText
并通过注入 KeyEvents 来完成,然后按数字。
我想用 Espresso 测试我的 android 应用。我有一个 editText
和 android:inputType="number"
.
如果我在考试中这样写:
onView(withId(R.id.editTextNumber)).perform(typeText("15"));
没用。但由于 typeText 不接受整数,我该如何执行此测试?
谢谢:)
试试这个:
onView(withId(blabla)).peform(typeText(String.valueOf("15"));
https://google.github.io/android-testing-support-library/docs/espresso/advanced/index.html
如果找不到任何方法将数字输入到 EditText 中,则必须避免使用 typeText
并通过注入 KeyEvents 来完成,然后按数字。