Issue
I tried to implement some unit and instrumented tests for my Android application (Java), my unit tests is working fine but instrumented tests are failing:
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ExampleInstrumentedTest {
@Rule
public IntentsTestRule<MainActivity> 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);
}
});
}
}
When I try to run my test I got this error :
"Run Android instrumented tests using Gradle" option was ignored because this module type is not supported yet.
My Implementations in build.config file are :
// 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'
Solution
the solution is to exclude module: protobuf-lite :
androidTestImplementation('androidx.test.espresso:espresso-contrib:3.4.0') {
exclude module: "protobuf-lite"
}
Answered By - NizarETH
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.