Sunday, April 14, 2013

Android - Robolectric - Unit testing setContentView

Normally the first thing we do in an Activity is to set the content view to a layout xml.
For example consider the below TestActivity, onCreate it sets its contentView to test_layout.xml

And the test_layout.xml is (Note : id of the root element android:id="@+id/test_layout_root")

In the robolectric test, we need to get the activity's content view id and assert it with the layout id

No comments:

Post a Comment