fan2597 / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
1 stars 2 forks source link

Multiple calls to a helper function containing onData will yield inconsistent results #82

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Created a helper method for performing taps to a button.

public void performFavoritesSelection(int photoIndex, int buttonId) throws 
InterruptedException{
        onData(anything())
                .inAdapterView(withId(android.R.id.list))
                .atPosition(photoIndex)
                .onChildView(withId(buttonId))
                .perform(click());
    }
2. In the test method, call this helper function multiple times.

public void testPickFavorites() throws InterruptedException {
        navigateToPickFavorites(0);
        performFavoritesSelection(0, noButtonId);
        performFavoritesSelection(0, maybeButtonId);
        performFavoritesSelection(0, yesButtonId);

        performFavoritesSelection(1, noButtonId);
        performFavoritesSelection(1, maybeButtonId);
        performFavoritesSelection(1, yesButtonId);
    }

What is the expected output? What do you see instead?

Expected: The test will cycle through all the button selections.
Actual: The results are inconsistent. Sometimes a button will not be selected. 
(e.g. on the device, it will appear as though "performFavoritesSelection(1, 
maybeButtonId);" is not called at times. The results are inconsistent. 
Sometimes, all6 calls are made. There are also times when 5/6 of the above 
calls are made.

What version of the product are you using? On what operating system?

Tested on a Nexus 4 on 4.4.2 and a Galaxy Tab 3 8.0 on 4.2.2

Please provide any additional information below.

None.

Original issue reported on code.google.com by kevingar...@gmail.com on 24 Jun 2014 at 10:49