Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
93 views

I'm in the process of changing the Screenshots created by my Android instrumentation tests androidx.test.runner.screenshot.ScreenCaptureProcessor (which worked) to the new androidx.test.core.app....
Martin's user avatar
  • 12k
0 votes
1 answer
161 views

I'm trying to update my screenshot routine used in the instrumentation tests of multiple projects using the new suggested method. Which is, of course, more complicated then the pervious version. There ...
Martin's user avatar
  • 12k
1 vote
1 answer
516 views

I'm working on setting up instrumentation tests in my java library gradle project using the androidx.test library. I added the following dependency in my build.gradle file: plugins { id 'java-...
Ghost's user avatar
  • 96
0 votes
0 answers
189 views

I am trying to test my ViewModel class. I believe that I need to use a HiltViewModelTest annotation but, Android Studio cannot find the file.. import androidx.test.ext.junit.rules.ActivityScenarioRule ...
greysqrl's user avatar
  • 977
3 votes
1 answer
1k views

I am writing a test and I get this error from a standard library: java.lang.IllegalStateException: Method addObserver must be called on the main thread This is my simplified test method: @Test fun ...
NoKey's user avatar
  • 464
1 vote
0 answers
645 views

Running Jacoco results in following error message: java.lang.NoClassDefFoundError: android/window/OnBackInvokedCallback at androidx.activity.ComponentActivity.<init>(ComponentActivity.java:...
Ralf Wickum's user avatar
  • 3,198
3 votes
1 answer
386 views

In a react-native project, ive recently updated to v66.4 from v63.2 after some dependency conflict troubleshooting, i ultimately get a merged manifest error, that indicates suggestions for 3 locations ...
Jim's user avatar
  • 2,330
0 votes
1 answer
235 views

I have a few "connected" tests that are only relevant to run on a specific device model or on a specific brand and should be skipped on other brands/models. I may be missing something, but ...
ben75's user avatar
  • 28.8k
8 votes
0 answers
1k views

Assumptions Robolectric controls which Android version to emulate, so I need this AndroidX has the test API for Jetpack Compose, so I need this as well Background I have experienced a lot of ...
Alix's user avatar
  • 2,886
0 votes
1 answer
632 views

I want to assert the activity is finished after clicking a button. eg: if the user clicked button with id R.id.finish, then the activity is finished. I'm trying to look up apis with ActivitySenerio ...
DevDengChao's user avatar
4 votes
0 answers
165 views

Previously with ActivityTestRule, one was able to override beforeActivityLaunched and afterActivityFinished to control app state before and after all tests (e.g, implementing a custom rule Class that ...
AaronMT's user avatar
  • 1,865
1 vote
1 answer
2k views

I am trying to write unit tests for a RecyclerView.ViewHolder class which uses ViewBinding but I am facing issues to inflate my ViewBinding in my test class, having this error when running my test : ...
Alan's user avatar
  • 1,344
5 votes
2 answers
721 views

I try to make a screenshot test with Espresso: Test class ScreenshotTest { @get:Rule var nameRule = TestName() @get:Rule var mActivityTestRule = ActivityTestRule(MainActivity::class.java) @Test ...
Denis Podzorov's user avatar
2 votes
0 answers
936 views

I'm getting into Android UI testing, and I learnt two ways to start up activities: ActivityScenario in each test, and ActivityScenarioRule once, annotated with @Rule. At first I used ActivityScenario, ...
Gtomika's user avatar
  • 905
1 vote
0 answers
713 views

I followed Android Developer doc and try to make a simple unit test in a Android Project. But I try to run the unit test with ApplicationProvider.getApplicationContext<Context>() than I got a ...
Jast Lai's user avatar
1 vote
0 answers
229 views

I'm trying to test my Activity, but couldn't able to import ActivityTestRule. My gradle file apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' // Add the Firebase ...
Manikandan's user avatar
  • 1,529
4 votes
1 answer
809 views

I want to test DialogFragment using androidx.fragment:fragment-testing lib. I call launchFragmentInContainer and moveToState(Lifecycle.State.RESUMED), but onCreateDialog is not called in this fragment....
Oleksandr Albul's user avatar
4 votes
1 answer
1k views

I have the following Project Structure: Main App --app --featureModule1 --featureModule2 --TestKit(Library module) where Testkit has all dependencies including app and featureModules. The Testkit ...
Amritpal Singh's user avatar
2 votes
1 answer
7k views

I am getting this issue while compiling my project I have tried a few solutions for that and that is More than one file was found with OS independent path 'META-INF/LICENSE' On gradle:3.0.0 ...
Chandela's user avatar
  • 312
3 votes
0 answers
704 views

So I'm having some issues with the login of an app. I've been trying to write an integration test for it... class LoginIT : AndroidIntegrationTest() { @get:Rule var loginActivityRule = ...
User1291's user avatar
  • 8,279
1 vote
1 answer
105 views

I am working on android library module and I want to test the standalone activity in my module. I was following the article https://medium.com/androiddevelopers/write-once-run-everywhere-tests-on-...
nik's user avatar
  • 71
4 votes
0 answers
1k views

I have an activity MyActivity which in turn holds a fragment MyFragment. In MyFragment I show a BottomSheetDialogFragment using the childFragmentManager as below: bottomSheetFragment.show(...
Henry's user avatar
  • 17.9k
5 votes
0 answers
921 views

I'm trying to test a BottomSheetDialog using androidx.test and Robolectric and hitting a problem with trying to click a button in the dialog. onView(withId(R.id.fab_add)).perform(click()) ...
Ben Neill's user avatar
  • 3,048
2 votes
1 answer
2k views

With AndroidX Test Framework now we can run Espresso test as unit test using Robolectric backend . But am confused when to use instrumentation test and when to use unit test. Let's say we've two ...
theapache64's user avatar
  • 11.9k
1 vote
1 answer
1k views

I am attempting to follow the Android ActivityScenario documentation to write Robolectric-based tests. Adding androidTestImplementation "androidx.test.core:app:1.2.0" to my build.gradle allows me to ...
Hélène Martin's user avatar
8 votes
1 answer
220 views

Recently I show one of the google IO video about androidX testing which quote "Write Once, Run EveryWhere". Which makes me exciting to learn about androidX testing library. And what I found that ...
Moinkhan's user avatar
  • 12.9k
1 vote
0 answers
657 views

This morning, my android studio updated automatically. And UI testing with espresso is broken. The android jetpack test module became an unresolved reference now. Do you have any solution for it? ...
hyung jun yoo's user avatar
3 votes
1 answer
1k views

I have a test suite for an android application, testing multiple scenarios. For most of them it makes sense to use AndroidX test framework's launchActivity. I also have, in the same suite, tests that ...
JE42's user avatar
  • 5,229
1 vote
1 answer
2k views

I am testing an AsyncTask that onPostExecute calls setValue of a LiveData instance. Since I am invoking setValue from onPostExecute no issues were expected regarding the invocation being done by the ...
Miguel Gamboa's user avatar
0 votes
1 answer
272 views

I am providing my own implementation of Application by creating a subclass and specifying the fully-qualified name of this subclass as the android:name attribute in AndroidManifest.xml's <...
Miguel Gamboa's user avatar
1 vote
0 answers
773 views

My fragment is as follows public class NerdLauncherFragment extends Fragment { private RecyclerView mRecyclerView; private final String TAG = this.getTag(); @Nullable @Override ...
Kartik's user avatar
  • 2,619
2 votes
0 answers
88 views

After extending AndroidJUnitRunner GrandPermissionRule stopped working and the test is blocked by permission dialog. Here is my runner class: package com.my.package import android.app.Application ...
Dawid Hyzy's user avatar
  • 3,801
1 vote
0 answers
87 views

I've started a new Project with testautomation. Some tests take some time These have been marked as @LargeTest. There are also some SmallTests (unit tests). The developers need to run the small tests ...
finder2's user avatar
  • 1,134
0 votes
1 answer
494 views

I am writing an Espresso test to test that my App Links are handled properly by my app. I've setup Android Studio and created a test that passes, but the problem is that the test suite hangs. I have ...
Chase Farmer's user avatar
2 votes
1 answer
306 views

Simple question: How can I use the androidx.test.annotation package? In which AndroidX library is it located? I'm specifically looking to use androidx.test.annotation.UiThreadTest. This annotation is ...
user2988's user avatar
  • 105
5 votes
1 answer
3k views

After I have added fragment-testing dependency to my project: // Testing dependencies espressoVersion = '3.2.0-beta01' testCoreVersion = '1.1.0' runnerVersion = '1.1.0' ...
amp's user avatar
  • 12.4k
5 votes
1 answer
4k views

I am having difficulty configuring my Android application for testing with AndroidX. When I attempt to run my initial test I get this error:- FAILURE: Build failed with an exception. * What went ...
Hector's user avatar
  • 5,802
5 votes
0 answers
589 views

Setup Robolectric: 4.2.1 AndroidX fragment-testing: 1.1.0-alpha05 Background With AndroidX comes new ways of testing fragments: Source: https://developer.android.com/training/basics/fragments/...
Alix's user avatar
  • 2,886
1 vote
1 answer
1k views

Since AndroidX release we are using Robolectric with Espresso in our unit tests. But we are unable to find a way to test dialogs. Espresso community suggests we do: onView(withId(android.R.id.button1)...
Heisenberg's user avatar
  • 3,183
2 votes
2 answers
6k views

I am a newbie in testing in android. Please help me write a unit test for this class. class SplashActivity : AppCompatActivity(){ override fun onCreate(savedInstanceState: Bundle?) { ...
Code_Life's user avatar
  • 5,922
15 votes
1 answer
7k views

After migration of code and tests to AndroidX, all seems to work pretty well, however Robolectric junit tests for two fragments are failing due to NoClassDefFoundError: androidx/fragment/testing/R$...
Marcin Bak's user avatar
  • 1,450
6 votes
4 answers
2k views

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 ...
Shadab Ansari's user avatar
0 votes
0 answers
94 views

I'm trying to reference an Activity in a UI test "androidTest" that is part of my main project folder, however, I keep getting the error "Unresolved reference". When I check what's happening, it looks ...
Phill Wiggins's user avatar
21 votes
3 answers
11k views

I have recently migrated my project to use AndroidX, and have configured test orchestrator for my espresso tests on gradle using the following docs: https://developer.android.com/training/testing/...
FlashAsh80's user avatar
  • 1,467