Android unit test/test.runner - access to Application object -


I am using the Android test.runner library and AndroidTestCase etc. to create some unit tests. I find this useful, but access to the application object for a test is required. Generally I only meet the context of that activity, eg. AppState AppState = (myActivity.getApplicationContext (applet););

However, the unit is in test class, which extends AndroidText Seeds, and as far as I can see, a GetApplicationContext is not available. There is a getContext, but it is not clear if I want this. What is the best way to act?

Are you testing your applet object, or testing something else that depend on it? Trying? If you are not testing upstate at this frequency, then you can use an instrument like mokoos to copy an applet object for your testing purposes.

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -