jneander
jneander

Reputation: 1190

Avoiding UI Limitations in ActivityUnitTestCase?

When attempting to build an example ActivityUnitTestCase around the Navigation Drawer example found on the Android developer site [link], getActionBar() is returning null during MainActivity.onCreate(). I have had similar problems with this test case when using Fragments in the given activity. While I have not seen it explicitly stated anywhere, it appears as though particular facets of the UI are not supported in this type of test.

Some documentation around those specific limitations would be helpful. I have not found anything of the sort on either developer.android.com or stackoverflow.com.

My Constraints

I am using Dagger to perform injection in my Activity's onCreate method, which effectively rules out ActivityInstrumentationTestCase2. That test case does not allow for mock Applications or Contexts, the former of which is being used during injection.

What should I explore for testing, given that I need pre-creation dependency injection without UI test case limitations?

Upvotes: 1

Views: 98

Answers (0)

Related Questions