mardi 24 février 2015

SugarORM + Android Studio + Unit Testing

I am trying to create a basic Book CRUD which works fine in the application code but I am trying to write unit tests for that entity.


During non-testing normal use, the Android manifest Application tag defines an application called "com.orm.SugarApp". This always gets called upon start up and it becomes the ApplicationContext at run time.


However, when I run my unit tests that extends InstrumentationTestCase, I find the breakpoints fire in the tests but com.orm.SugarApp Application is not initialized. The constructor for com.orm.SugarApp does not get invoked before the CRUD calls are made.


How can I configure Android Studio/Gradle to execute unit tests with com.orm.SugarApp as a prerequsite application already initialized.


Aucun commentaire:

Enregistrer un commentaire