I can’t find any examples or help in the JavaDocs on how to use an Android test to get at the SearchView in the Menu for testing. Is there a way to do it?
I would like to do do a .setQuery("Foo", true) or equivalent to test search in my app. How can that be done?
According to this documentation
If you have expanded the serach view for the KEYCODE_SEARCH event,then testing should be possible by using the instrumentation to inject events.
Make sure you have the inject permission in your manifest.