Created
May 4, 2015 06:53
-
-
Save lparoli/413e186b34512997346e to your computer and use it in GitHub Desktop.
Base class for your Espresso tests, using JUnit4.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package qa.com.espressospoonstructure.tests; | |
| import android.app.Activity; | |
| import android.support.test.InstrumentationRegistry; | |
| import android.support.test.runner.AndroidJUnit4; | |
| import android.test.ActivityInstrumentationTestCase2; | |
| import org.junit.After; | |
| import org.junit.Before; | |
| import org.junit.runner.RunWith; | |
| @RunWith(AndroidJUnit4.class) | |
| public abstract class BaseTestCase<T extends Activity> extends ActivityInstrumentationTestCase2<T> { | |
| protected BaseTestCase(Class<T> activityUnderTest) { | |
| super(activityUnderTest); | |
| } | |
| @Before | |
| public void setUp() throws Exception { | |
| super.setUp(); | |
| //Required by JUnit4 | |
| injectInstrumentation(InstrumentationRegistry.getInstrumentation()); | |
| //Launches your activity | |
| Activity activity = getActivity(); | |
| } | |
| @After | |
| public void tearDown() throws Exception { | |
| super.tearDown(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment