Questions tagged [androidx-test]

41 questions
1
vote
0 answers

Calling click on ViewHolder in Espresso test for RecyclerView does not call the Onclick listener of the view holder

My fragment is as follows public class NerdLauncherFragment extends Fragment { private RecyclerView mRecyclerView; private final String TAG = this.getTag(); @Nullable @Override public View onCreateView(@NonNull LayoutInflater…
Kartik
  • 2,541
  • 2
  • 37
  • 59
1
vote
0 answers

How to start only SmallTest in Android Studio

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 more often. I have searched through the web some…
finder2
  • 842
  • 1
  • 11
  • 30
1
vote
1 answer

AndroidX test dialog

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)) .inRoot(isDialog()) …
Heisenberg
  • 3,153
  • 3
  • 27
  • 55
1
vote
2 answers

How to unit test startActivity?

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?) { super.onCreate(savedInstanceState) val intent…
0
votes
0 answers

How to test ViewModel using AndroidX and Hilt

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 import…
greysqrl
  • 937
  • 3
  • 13
  • 31
0
votes
0 answers

Espresso not invoking click listener in viewholder item?

I have a recyclerview adapter which takes an onclick listener as a constructor parameter like so Adapter{}. The clicklistener is then passed to the ViewHolder constructor in onCreateViewHolder. In the ViewHolder, when a view inside the itemView is…
0
votes
1 answer

Filtering Android Connected Tests

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 this kind of filtering seems not possible out-of-the-box…
ben75
  • 29,217
  • 10
  • 88
  • 134
0
votes
1 answer

How to assert the activity is finished with espresso

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 and Espresso, but none of these…
DevDengChao
  • 198
  • 15
0
votes
1 answer

Wrong application instance from ApplicationProvider.getApplicationContext

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 tag as:
Miguel Gamboa
  • 8,855
  • 7
  • 47
  • 94
0
votes
1 answer

How should I properly shutdown my AndroidX Espresso test?

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 created a class, LinkDispatcherActivity, that is…
Chase Farmer
  • 113
  • 9
0
votes
0 answers

Unresolved reference - what's going on?

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 as though my imports are trying to reference the…
Phill Wiggins
  • 2,577
  • 4
  • 28
  • 33
1 2
3