False positives: junit.framework.AssertionFailedError: EditText is not found


I have a problem setting up Robotium tests to run on Travis without random false posivities.

Every couple of builds I get

pl.mg6.agrtt.TestActivityTests > testCanEnterTextAndPressButton[test(AVD) - 4.4.2] FAILED
.framework.AssertionFailedError: EditText is not found!
at com

on all my tests.

I have created a simple project on GitHub to show the issue.

You may see how it builds on Travis. Note build #7 failed after modyfing unrelated file.

I’m suspecting this to be caused by emulator being locked or its sceeen dimmed. I could reproduce this issue on local machine by turning connected device’s screen off and then running

./gradlew connectedAndroidTest

After modyfing tests I got a different error message, which is somewhat more informative, so I’m adding it just in case someone tries to find a solution:

pl.mg6.agrtt.TestActivityTests > testCanFindViewsEnterTextAndPressButton[test(AVD) - 4.4.2] FAILED
.framework.AssertionFailedError: Click at (160.0, 264.0) can not be completed! (java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission)
at com
  • You must to post comments

While the root cause of this problem is still unknown to me, after some investigation and with a help from Robotium’s author Renas Reda I could confirm what I initially suspected that emulator indeed locks itself.

A workaround I’m using now is this code put in setUp method:

getInstrumentation().runOnMainSync(new Runnable() {
public void run() {
  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.