through my own tests and through Googling that the emulators don't
support voice recognition. Specifically, when I try to run my test it
gives this error.
No Activity found to handle Intent
{ action=android.speech.action.RECOGNIZE_SPEECH (has extras)
My thought was that I could create a MockContext that could return a
MockPackageManager that could override queryIntentActivities and spoof
my app into thinking that voice recognition is there for testing
purposes. I'm thinking that my tests can use ActivityMonitor to
return simulated speech recognition results when the app goes looking
for speech input.
Does this sound relatively sane so far?
My problem is that I cannot get past the error above. When I run the
test in the debugger and put in tons of breakpoints, I can see that
the getPackageManager method on my MockContext isn't getting called.
So presumably I'm not getting the mock context plugged in correctly?
Or too late?
I was originally using ActivityInstrumentationTestCase2, but with this
there doesn't seem to be any hook to plug in a MockContext. This link
-- http://tenacious33.wordpress.com/2009/12/15/android-functional-testing-with-mockcontexts/
-- suggested adding setters on my Activity class to set the context
directly from the test, but that doesn't seem to do the trick.
I have now switched to ActivityUnitTestCase, and I am calling the
setActivityContext method in my setUp method. But I still get the
error above and my getPackageManager method is not getting called.
Can somebody point me to an example or give me some thoughts on how to
use a MockPackageManager?
And/or, has anybody had success with automated testing of voice
recognition on the emulator?
Thanks!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment