Questions tagged [instrumented-test]

Framework for Android instrumented testing to interact with UI components.

116 questions
0
votes
1 answer

In a Hilt Instrument Test, can you have two ViewModels for @BindValue?

I am having some issues with a instrument test using Hilt. The problem is that I have to deal with two viewModels, one for the activity and then one for the base class. Here is what I have: @RunWith(AndroidJUnit4::class) @HiltAndroidTest class…
Kristy Welsh
  • 7,828
  • 12
  • 64
  • 106
0
votes
0 answers

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/myproject/mymodule/ClassName in Android Instrumented Tests

can anyone help to solve this problem? Previously, i try to create a instrumented test for my project. I create new module for unit test and an error occurred in the module when I created the class, then I generated class to create an instrumented…
0
votes
0 answers

kotlin android junit4 parameterized test

i got an issue, i try to do a multi argument parameterized test with junit for instrumented test: @RunWith(Parameterized::class) class PileAddEditTopbarColorTest( private val testedPile: WoodPile private val testedColor:…
arist0v
  • 79
  • 8
0
votes
0 answers

Get context of test project in Android junit test , not InstrumentedTest

I need to use Jacoco, but I need to get context. When I use this command I got this error: No instrumentation registered! Must run under a registering instrumentation. Is there a way to use jacoco in InstrumentedTest? public class ExampleUnitTest…
0
votes
0 answers

Run android instrumented test without emulator GUI

I could run Android instrumented tests like this. And an emulator will be opened before test execution. ./gradlew clean app:connectedVariantNameAndroidTest Can we do it without this emulator GUI? Because with Xcode/iOS, I could perform instrumented…
Zhou Haibo
  • 1,681
  • 1
  • 12
  • 32
0
votes
1 answer

How to retry on failed Android instrumented tests?

I'm searching for a way to retry run failed Android instrumented tests or called integration tests/ui tests. I think there could have 3 ways of doing this. Retry with Jenkins stage script -> retrieve all failed tests and perform them again with run…
Zhou Haibo
  • 1,681
  • 1
  • 12
  • 32
0
votes
0 answers

Android - "Navigation destination that matches request NavDeepLinkRequest{ uri=android-app:/XXX } cannot be found" in fragment testing

I'm working on a multi-module single activity application. Each feature module has its own navigation graph. I'm trying to navigate to a feature module from the another one using deep link as recommended in the official doc. (here) When I run the…
0
votes
1 answer

instrumentTesting with Espresso when facing with Splash Screen API and Navigation

How to perform Instrumental Testing or Android Testing when using Splash Screen API and Navigation. As we know, Activity is no longer needed to create splash screen, we just need to make new Theme to implement the Splash Screen API. And for…
0
votes
0 answers

Gradle task `connectedXXXAndroidTest` doesn't perform test cases under 1 specific directory

The instrument test file structure in AD is like this: com.companyname.propjectname integrationtest: 20 test cases systemtest: groupA: 30 test cases [x] groupB: 50 + test cases And I used a custom build variant(XXX) for test…
0
votes
0 answers

error: [Hilt] Null baseElement: java.lang.NullPointerException: Null baseElement

I am trying to use Hilt to write some UI instrumented test. I followed instructions given at developer site to setup Hilt for tests. But when i try running the test, i get following error - Task :app:kaptDebugAndroidTestKotlin FAILED e: error:…
user1122549
  • 664
  • 1
  • 13
  • 27
0
votes
0 answers

How to run/invoke Instrumented Tests from within Android App code (MainActivity)

In the current arrangement, on Android, Instrumented Tests can be invoked by following approaches: From within Android Studio -> Right click on the class saved under "androidTest" Fire command adb shell am instrument -w…
GBN
  • 1
  • 1
0
votes
1 answer

Is there any way to make the application not restart at each @Test while running the android UI tests, but run all the testcases without restarting?

In the app I'm testing during onboarding there are tutorial screens that I want to test in separate @Tests, but between tests the app quits and restarts and this causes the tutorial to skip and jump to the main screen.
0
votes
0 answers

interpretation 2SLS Instruments diagnostic test, choice of Instruments

I have some questions regarding the interpretation of my 2SLS Regression model on a Panel data set (10 Years, 190 countries). I use in total 4 Instruments, which I can argue for. In the first stage not all Instruments are statistically significant,…
0
votes
0 answers

Code block on MainCoroutineDispatcher fails to execute during instrumented test

I am working on an Android project in Android Studio (Electric Eel, 2022.1.1) and I am facing an issue where the UI update task that runs on the MainCoroutineDispatcher never gets executed. My activity makes a call to callBackend during onCreate,…
Corin
  • 2,417
  • 26
  • 23
0
votes
0 answers

INSTALL_FAILED_UPDATE_INCOMPATIBLE when restoring from AVD cache for CI/CD pipeline instrumented tests

I'm trying to make a github actions workflow to run instrumented tests on Android. My file has steps similar to: actions/checkout@v3 actions/setup-java@v3 gradle/gradle-build-action@v2 actions/cache@v3 if: steps.avd-cache.outputs.cache-hit !=…