运行 Android 检测测试失败
发布时间:2022-07-19 17:48:11 277
相关标签: # java
我试着为我的Android应用程序(Java)实现一些单元测试和插装测试,我的单元测试工作正常,但插装测试失败了:
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ExampleInstrumentedTest {
@Rule
public IntentsTestRule mActivityRule = new IntentsTestRule<>(MainActivity.class);
@Test
public void checkIfCategoriesIsNotEmpty() {
onView(withId(R.id.header_left_layout)).perform(click());
onView(withId(R.id.list_view)).check(new ViewAssertion() {
@Override
public void check(View view, NoMatchingViewException noViewFoundException) {
ListView list_categories = (ListView) view;
ListAdapter adapter = list_categories.getAdapter();
Assert.assertTrue(adapter.getCount() > 0);
}
});
}
}
当我尝试运行测试时,出现以下错误:
"Run Android instrumented tests using Gradle" option was ignored because this module type is not supported yet.
我在构建中的实现。配置文件包括:
// UNIT TEST
testImplementation 'junit:junit:4.12'
testImplementation 'org.hamcrest:java-hamcrest:2.0.0.0'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.7.1'
// INSTRUMENTED TEST
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.4.0'
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报