Skip to content

Instantly share code, notes, and snippets.

@jabKnowsNothing
Last active November 4, 2015 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jabKnowsNothing/b141a4fdf260a7a4a6a2 to your computer and use it in GitHub Desktop.
Save jabKnowsNothing/b141a4fdf260a7a4a6a2 to your computer and use it in GitHub Desktop.
Old example test case with ActivityInstrumentationTestCase2
public class MyOldTest extends ActivityInstrumentationTestCase2<MyActivity> {
public MyOldTest() {
super(MyActivity.class);
}
@Override
protected void onSetUp(Context context) {
super.onSetUp(context);
// Do all my test set up here
Intent myCustomIntent = new Intent();
// Add extras and stuff
// Maybe prepare some mock service calls
// Maybe override some depency injection modules with mocks
setActivityIntent(myCustomIntent);
getActivity(); // launch activity under test
}
@Override
protected void tearDown() {
// destroy stuff
}
public void testStuff() {
// Verify Oscar Grouch is grouchy
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment