Espresso 2.0과 함께 제공되는 ActivityInstrumentationTestCase2
클래스를 사용할 때 별난 경고 Method annotated with @Test inside class extending junit3 testcase
이 나타납니다.Espresso 2.0 - @Test로 주석이 달린 메소드에서 junit3 테스트 케이스를 확장하는 클래스
내 클래스는 단지 구글은 예로서 제공되는 하나처럼 보이는 : 나는 build.gradle에 필요한 모든 일을 추가 한
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());
// Check that Instrumentation was correctly injected in setUp()
assertThat(getInstrumentation(), notNullValue());
}
@After
public void tearDown() throws Exception {
super.tearDown();
}
}
: 어떤 방법으로는
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'
}
있는가 이 경고를 멀리합니까?
이 지침을 사용하고 있습니까? https://code.google.com/p/android-test-kit/wiki/EspressoSetupInstructions – helleye
그래도 사용 했으므로 빌드시에 – Niklas
을 사용했습니다. 당신은 또한 테스트를 포함하여'// App의 의존성을 가지고있다.com.android.support : support-annotations:21.0.3 ' ' – helleye