Skip to main content

All Questions

0 votes
0 answers
27 views

How to identify the best method to test a function in Android Studio?

Below is a function in our Android application designed to update the app with a new installation of its current version. However, each approach I've attempted has encountered significant obstacles, ...
user25102566's user avatar
0 votes
0 answers
26 views

How I can test location service, and it's permissions with junit?

Is it possible to write to write instrumental tests and later on for location permissions? I'm relatively new to testing topic, and I haven't found much examples that could possibly help me with it.
SmierdzoncaRobotaEhhh's user avatar
0 votes
0 answers
32 views

uiState not updating in Tests

Does anyone have any idea why my uiState is not updated in the tests? The strange thing is that in the app running if it is updated, but when testing the viewmodel and send events does not update the ...
Marco Portacio's user avatar
0 votes
0 answers
17 views

Android Test case Intent Response handling if there is no intent in the activity and you just want to write intent only in test class

I have 2 activity 1st activity don't have any intent and the second activity have collection of operation like finger capture and device info and many more if you send intent with setAction "...
Prakash Kumar Namdeo's user avatar
0 votes
0 answers
27 views

Could not mock EglBase when trying to write test code

I am trying to write a test code for a function. public void initializeRenderers() { if(eglBase == null) { eglBase = EglBase.create(); } if(renderersInitiated)...
Usama's user avatar
  • 32
0 votes
0 answers
94 views

How to migrate TestCoroutineDispatcher to UnconfinedTestDispatcher

I wrote a test for my ViewModel but just realized that TestCoroutineDispatcher is deprecated. It seems that UnconfinedTestDispatcher would be ideal for my tests and I have tried to migrate my test to ...
user19334054's user avatar
0 votes
0 answers
76 views

Android Kotlin: Failed StateFlow initialization on fake Repository between test cases in Unit test

I've written unit tests for my viewmodel, which takes a fake repository as a constructor. When I run my insertNote() test standalone, which insert a value to a StateFlow in my repository and evaluates ...
Hegyi István's user avatar
0 votes
0 answers
64 views

Conditional to Ignore Code in Android Unit Tests?

I have a thin wrapper LogWrapper around android.util.Log that I have used throughout most of my code. When I write unit tests in my code, I often get an error like Method "d" in android.util....
Merlin -they-them-'s user avatar
1 vote
0 answers
125 views

Test ViewModel with Jetpack Compose e compose state

I'm getting the following error in my ViewModel test, it's pretty clear, but I can't figure out why. Parameter specified as non-null is null: method androidx.paging.CachedPagingDataKt.cachedIn, ...
Daniel Lopes's user avatar
0 votes
1 answer
653 views

Android Unit Test: Mockk io.mockk.MockKException: Missing calls inside every { ... } block

I have a simple function inside my repository class, that function will parse a static response from the asset and return the result. tried to write a unit test of that function but somehow my test is ...
Imtiaz Dipto's user avatar
1 vote
0 answers
120 views

Testing on Lottie Android - Assert color

In my Android application, I used to have a ProgressBar that, in a test, would check the color assigned to the view. assertEquals( ColorStateList.valueOf( Color....
Sergio76's user avatar
  • 3,946
4 votes
1 answer
439 views

How is it possible to instantiate a ViewModel in a unit test?

The following codelab instantiates a ViewModel in a unit test without using Robolectric or any mock library. https://developer.android.com/codelabs/basic-android-kotlin-compose-test-viewmodel How is ...
Tatsuya Fujisaki's user avatar
2 votes
0 answers
236 views

How to mock Boolean field? Error Cannot mock/spy class java.lang.Boolean

I am trying to mock on field and return needed value but got error here is error Cannot mock/spy class java.lang.Boolean Mockito cannot mock/spy because : - Cannot mock wrapper types, String.class or ...
Bob Redity's user avatar
1 vote
1 answer
204 views

How (and should) I verify that an async internal method was called in State Unit Testing?

override fun getSomething(): LiveData<List<Content>> { fakeDataSource.fetchSomethingAsync() return contentDao.getSomething() } Here we have a repository method to get ...
Jon's user avatar
  • 8,011
5 votes
2 answers
4k views

Jetpack Compose, how to test navigation?

I'm quite new in testing and I want to learn how do I test navigation which includes Jetpack Compose Ui Screens with ViewModels. How can I for example test that when I click on button in Home Screen, ...
deja's user avatar
  • 446

15 30 50 per page
1
2 3 4 5
19