I got a strange warning Method annotated with @Test inside class extending junit3 testcase when using the new ActivityInstrumentationTestCase2 class that comes with Espresso 2.0.
My class looks just like the one provided by Google as an example:
import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import android.test.ActivityInstrumentationTestCase2; import android.test.suitebuilder.annotation.LargeTest; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import static android.support.test.espresso.matcher.ViewMatchers.assertThat; import static org.hamcrest.Matchers.notNullValue; @RunWith(AndroidJUnit4.class) @LargeTest public class MyCoolActivityTests extends ActivityInstrumentationTestCase2<MyCoolActivity> { private MyCoolActivity mActivity; public MyCoolActivityTests() { super(MyCoolActivity.class); } @Before public void setUp() throws Exception { super.setUp(); injectInstrumentation(InstrumentationRegistry.getInstrumentation()); mActivity = getActivity(); } @Test public void checkPreconditions() { assertThat(mActivity, notNullValue());
I added all the necessary things to build.gradle:
android { defaultConfig { testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } } dependencies { androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0' androidTestCompile 'com.android.support.test:testing-support-lib:0.1' }
Is there any way to get this warning?
source share