Wednesday, 15 June 2011

android - Preparing target test application's context for testing -



android - Preparing target test application's context for testing -

i have android app , test project running unit tests , automated ui tests, using robotium. want create sure target app's context in state before each test started up. normally, 1 in setup() method of test class.

that target app's application instance initialisation work based on values in shared pref store. want create sure these values set relevant test project's needs.

the problem target application instance's oncreate() method executed before setup() method. therefore, values test's setup() method not taken consideration. right way initialisation work?

one way accomplish create faketestonlyactivity doing init work in oncreate before calling super.oncreate() :

public faketestonlyactivity extends activitytotest { public void oncreate(bundle savedinstancestate){ //do initialization ... super.oncreate(savedinstancestate); } }

android robotium android-testing

No comments:

Post a Comment