public void testRefreshMenuItem() {
        // When the refresh menu item is selected
        getInstrumentation().invokeMenuActionSync(mTestActivity, R.id.menu_refresh, 0);

        // Then the SwipeRefreshLayout should be refreshing
        assertTrue(mSwipeRefreshLayout.isRefreshing());
    }
Test that selecting the refresh menu item triggers a refresh.
SwipeRefreshMultipleViews/Application/tests/src/com/example/android/swiperefreshmultipleviews/tests/SampleTests.java