Questions tagged [androidjunitrunner]
26 questions
7
votes
0 answers
Caused by: java.lang.NoSuchMethodError: No static method listOf(Ljava/lang/Object;)Ljava/util/List; in class Lk/v/i; or its super classes
I'm using kotlin collections library (listOf, first, toList, etc,..) methods in our AndroidTest package to run UI tests using AndroidJunit4 runner and I'm coming across these type of errors wherever I refer to kotlin collections…

deepu
- 73
- 1
- 4
7
votes
0 answers
Custom Test Orchestrator or callback for start/finish
I'm using the Android Test Orchestrator to run my UI tests and i need to generate a report of the results when all the tests are finished.
I need to have a callback for when the orchestrator starts running the tests and when it finishes running all…

dvdciri
- 441
- 6
- 19
6
votes
0 answers
Code coverage with Jacoco in android while using Orchestrator
I am trying to get coverage report from our test suite which needs to run with Android Test Orchestrator.
There is a fixed issue which references another fixed issue.
Following their suggestion I have added
testInstrumentationRunnerArguments…

saiedmomen
- 1,401
- 16
- 33
6
votes
4 answers
No tests found when using custom runner
I'm using androidx.test libraries(which I migrated to recently) in my project and using custom AndroidJUnitRunner.
Before migration it was all working fine but now I'm getting this error -
Started running tests
Test running failed: Instrumentation…

Shadab Ansari
- 7,022
- 2
- 27
- 45
4
votes
2 answers
Generated Android espresso test fails to run, AndroidJUnitRunner failed to resolve: Landroidx/test/platform/io/FileTestStorage;
After recording a simple espresso test on my app the test fails to run and I'm hoping someone can guide me as to why this is happening. The resulting error is:
D/AndroidJUnitRunner: Use the raw file system for managing file I/O.
E/AndroidRuntime:…

MKE
- 109
- 11
4
votes
1 answer
Get resource from Android test: InstrumentationRegistry.getInstrumentation().getTargetContext() VS myActivityTestRule.getActivity()
I need to get resource from Android test (AndroidJUnit4ClassRunner). What is the recommended way and why?
String some_res_string =…

Yuliia Ashomok
- 8,336
- 2
- 60
- 69
3
votes
1 answer
How to apply a Rule to all test cases in a AndroidJUnitRunner?
I'm trying to apply a TestWatcher as a rule across all my test cases run by a particular runner.
MetadataCollector:
class MetadataCollector : TestWatcher() { ... }
TestRunner:
class TestRunner : AndroidJUnitRunner() {
override fun…

Dragan R.
- 598
- 4
- 18
2
votes
0 answers
testInstrumentationRunnerArguments is deprecated and replaced by property
Earlier to ensure that the app's state is completely cleared between tests we used in gradle the command:
testInstrumentationRunnerArguments clearPackageData: 'true'
In gradle 7.0.3 and higher this command has been already deprecated doesn't…

Stanly T
- 964
- 1
- 12
- 30
2
votes
0 answers
jUnit4 - Why testing a suspendable function fails with `RuntimeException: ... AndroidJUnit4 could not be loaded`?
When I test a simple db written with Room, a test that expects an exception fails when dao functions are declared with suspend.
The error is:
java.lang.RuntimeException: Delegate runner 'androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner'…

eqtèöck
- 971
- 1
- 13
- 27
2
votes
1 answer
AndroidJUnit4ClassRunner throwing RuntimeException Android
I am developing an Android app. I am writing the Junit test for the android and I am a novice in the Junit test case.
In-app I have one relative layout on click of that I am opening date picker dialog box and once the user selects the date I am…

Harsh Shah
- 2,162
- 2
- 19
- 39
2
votes
1 answer
Unable to find instrumentation info for: ComponentInfo{../android.support.test.runner.AndroidJUnitRunner}
I have written a simple Android instrumental test case to test networking operation.
Test case class name: Main3ActivityTest.java
Method name:addNewEmployee
I run my test case using command line then I got following exception.
Command:
./adb -s…

M.A.Murali
- 9,988
- 36
- 105
- 182
2
votes
1 answer
Espresso AmbiguousViewMatcherException: How can I select a first horizontal Recyclerview from multiple horizontal Recyclerview
There are multiple horizontal Recyclerview on a screen. I want to perform a espresso click event on first item of first horizontal Recyclerview. Please let me know how we can achieve it.
…

chank007
- 240
- 2
- 8
2
votes
0 answers
AndroidJUnitRunner and JUnit versions after 4.10
According to AndroidJUnitRunner documentation,
The test runner is compatible with your JUnit 3 and JUnit 4 (up to JUnit 4.10) tests
Does it mean there are known incompatibilities with 4.11 and 4.12, and if so, what are they? Or was this simply…

Alexey Romanov
- 167,066
- 35
- 309
- 487
1
vote
2 answers
How to use Android Test Orchestrator in command line?
Am seeing crashes while running tests from CI. Read this article(https://developer.android.com/training/testing/junit-runner#ato-gradle) about using Android Test Orchestrator. Am using adb to run my tests from CI. want to know how do I install…

Suba Ram
- 31
- 2
1
vote
0 answers
Android espresso: Why does ActivityTestRule send a null Intent when I start the activity under testing?
This The Test that I created from MainActivity.
@RunWith(AndroidJUnit4.class)
public class MainActivityTest {
public static final String KEY_IMAGE_DATA = "data";
MainActivity mainActivity;
@Rule
public…

Jean Carlo Flores Carrasco
- 11
- 1
- 3