我正在尝试运行'createDebugAndroidTestCoverageReport',但是当我在build.gradle中更改以下选项时,它会向我抛出错误
defaultConfig{
//from
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
//to
testInstrumentationRunner 'com.test.modules.runner.JunitTestSuite'
}
错误: com.android.builder.testing.ConnectedDevice>找不到测试。[rooted-device(AVD)-4.4.2]失败 找不到测试。这通常意味着您的测试类的格式不符合测试跑步者期望的形式(例如,不要从TestCase继承或缺少@Test批注)。
任务:app:connectedDebugAndroidTest失败
JunitTestSuite如下:
@RunWith(Suite.class)
@Suite.SuiteClasses({
Test1.class,
Test2.class
})
public class JunitTestSuite {
}
Test1.class
@LargeTest
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@RunWith(AndroidJUnit4.class)
public class Test1 {
public static ViewInteraction replacePassword;
public static ViewInteraction clickLoginButton;
public static ViewInteraction clickCountOnHomePage;
public static ViewInteraction clickOnCounts;
public static ViewInteraction clickOnFixture;
@Rule
public ActivityTestRule<LoginActivity> mActivityTestRule = new ActivityTestRule<>(LoginActivity.class);
@Test
public void a_amcount() {
CommonUtil.amTime();
WaitForUIUpdate.waifForWithId(R.id.username, null);
WaitForUIUpdate.waifForWithId(R.id.username_input_layout, null);
onView(withId(R.id.username)).check(ViewAssertions.matches(isDisplayed()));
onView(withId(R.id.username_input_layout)).check(ViewAssertions.matches(isDisplayed()));
}}