Hi, I believe the correct way to write functional unit tests spanning
multiple activities (and have some injection points for mocks too) is to
use InstrumentationTestCase directly.
In setup do:
instrumentation = getInstrumentation();
Context context = instrumentation.getTargetContext();
application = (AppFx)Instrumentation.newApplication(AppFx.class, context);
In your test do:
launchActivity("com.mypackage", MyActivity.class, null);
and any asserts you want.
My issue though is that if I have multiple such test cases they interfere
with each other. The reason for calling newApplication is to get a hold of
the application BEFORE onCreate etc is called on it, so dependency
injection my occur. Perhaps this is why I get interference between test
cases.
Please let me know if this helps, and if you can take it further to solve
my issue!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en