When I run the following test in the Android emulator, the input value doesn’t show up in the EditText. Why doesn’t it? And what do I need to change so that I can see the input in the emulator? (The test passes, so in the end, it probably doesn’t matter. I just would like to be able to see it actually happen in the emulator.)
public void testOkButtonOnClickWithUserInputNumber() throws Throwable {
this.sendKeys(Integer.toString(this.testNumber)); // 123
this.runTestOnUiThread(new Runnable() {
@Override
public void run() {
Assert.assertTrue(NumberFilterTest.this.okButton.performClick());
}
});
this.getInstrumentation().waitForIdle(new Runnable() {
@Override
public void run() {
Assert.assertTrue(NumberFilterTest.this.activity.isFinishing());
}
});
}
Check out official dev guide – Activity Testing.
1 Make sure touch mode is turned off:
2 Make sure screen is unlocked: