Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
124 views

I am using a baseline profile for my app, and it works well when using a benchmark test for measuring performance, but when I try to run the baseline profile generator then it run the specified path ...
Hafizur Rahman's user avatar
0 votes
0 answers
28 views

I want to add a listener for instrumented tests (the src/androidTest subrirectory). I added this, and I see that the test listeners listen only to unit tests. (############### is printed always, but ...
18446744073709551615's user avatar
0 votes
1 answer
166 views

I have updated my test cases dependencies from this to this(as given below in code snippet ), since then I am facing this error of java.lang.NullPointerException: Cannot run onActivity since Activity ...
Sopnil.Shinde's user avatar
2 votes
2 answers
129 views

Within an existing project with espresso tests, I want to parameterized espresso tests so I add in the project configuration the declaration implementation 'com.google.testparameterinjector:test-...
C.B.'s user avatar
  • 339
1 vote
1 answer
126 views

I'm trying to execute two test methods, one of which is a junit and the other is an Android Test in a sequential manner. The first junit test method will be executed, followed by an Android Test. I ...
Maverick's user avatar
  • 394
0 votes
1 answer
2k views

I tried to test the ViewModel using Junit and Mockito, getting null pointer exception. It returns cannot invoke flow collector. I want to test the responses coming in MpinDataKey, check all parameters ...
Cijo K Paul's user avatar
0 votes
1 answer
142 views

Trying to mock static object GoogleSignIn.getClient() method but getting this error from the initialize() method: getClient(context, gso) must not be null java.lang.NullPointerException: getClient(...
rysv's user avatar
  • 3,532
1 vote
0 answers
159 views

Suggest any solution in kotlin or java for retry 1 or 2 times only failed test case Tried many solution but does not work any properly
ASHOK DAUKIYA's user avatar
3 votes
1 answer
5k views

Maybe this is very basic question but could not find anything online. I have created a object class in kotlin contains few methods. I am calling those from ViewModel and I have written junit test case ...
VVB's user avatar
  • 7,671
5 votes
3 answers
1k views

I would like to configure testLogging for my instrumented tests. However, Gradle seems to ignore my configuration in android.testOptions.unitTests.all.testLogging. There, I have configured that all ...
Martin's user avatar
  • 746
2 votes
1 answer
3k views

Hi Following is my part of code which I want to test with various requests but I am unable to test as it is observable subscriber patter any idea how to mock subscriber or how to wait for a result in ...
amodkanthe's user avatar
  • 4,540
0 votes
1 answer
3k views

using robolectric version 4.5.1 What is the difference between shadowOf(getMainLooper()).idleFor(1, TimeUnit.MILLISECONDS); and shadowOf(getMainLooper()).idle(); shadowOf(getMainLooper()).idle(); ...
amodkanthe's user avatar
  • 4,540
-1 votes
1 answer
537 views

Am getting following error while am trying to execute android example instrumented test. As this is my first instrumented test which am getting error. Here is my Manifest file and gradle file. Android ...
Ritthisha S's user avatar
5 votes
0 answers
3k views

I recorded an Espresso test using the recorder in Android Studio 4.2.2, which included a single assertion that a text field on my MainActivity UI was showing with the correct text string. I then saved ...
tfrysinger's user avatar
  • 1,356
1 vote
1 answer
2k views

Android app, Having a function calling another function, that function may throw static string SOME_DEFINE_1 = "some_define_1"; ...... void myFunc() { try { HashMap<...
lannyf's user avatar
  • 11.1k
3 votes
1 answer
774 views

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 : ...
Dragan R.'s user avatar
  • 680
1 vote
1 answer
1k views

Is there a class/method I could implement within JUnit that is basically a "hook" that runs after each test case finishes, with user-defined (in code) metadata available? I'm trying to ...
Dragan R.'s user avatar
  • 680
1 vote
1 answer
523 views

I have implemented a ContentProvider that uses a Room database to store the data. The implementation is done in kotlin and it follows the same pattern shown in this Google example. The ContentProvider ...
narko's user avatar
  • 3,945
6 votes
2 answers
849 views

I'm running a espresso uiautomator test which runs well when using the green run > button on android studio. (image below) Yet ./gradlew connectedAndroidTest is giving an error: No Koin Context ...
ir2pid's user avatar
  • 6,256
0 votes
0 answers
145 views

I want to test fragment navigations, which is handled by the MainActivity. for that I have created HomeFragmentTest class @MediumTest @RunWith(AndroidJUnit4::class) class HomeFragmenTest { @Rule @...
Jemo Mgebrishvili's user avatar
4 votes
1 answer
1k views

I need to get resource from Android test (AndroidJUnit4ClassRunner). What is the recommended way and why? String some_res_string = androidx.test.platform.app.InstrumentationRegistry....
Yuliia Ashomok's user avatar
7 votes
0 answers
3k views

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 ...
deepu's user avatar
  • 73
2 votes
0 answers
1k views

I have a fragment that uses the delegation pattern when a button is clicked. class FutureMeetingEventViewFragment @Inject constructor(): Fragment() { @Inject lateinit var ...
Marc Freeman's user avatar
7 votes
2 answers
3k views

I'm getting this error while trying to use FragmentScenario in Android error: package androidx.fragment.app.testing does not exist import androidx.fragment.app.testing.FragmentScenario; ...
chrizonline's user avatar
  • 4,999
28 votes
6 answers
120k views

As I understand, lenient silences the exceptions thrown by StrictStubbing. Based on this, lenient shouldn't be used, maybe only temporary while doing TDD, because strict stubbing exceptions would ...
htafoya's user avatar
  • 19.4k
2 votes
1 answer
894 views

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 ...
Harsh Shah's user avatar
  • 2,402
0 votes
1 answer
75 views

I have PaymentPresenter with method payWorkOrder(). That method accepts some parameters and based on the logic created two new objects: WoPayment PaymentRequest Here is the code for that: @RunWith(...
Zookey's user avatar
  • 2,707
0 votes
1 answer
586 views

I am writing test cases for a device testing in which I will have to check some Wifi, Messaging, Camera and Audio Apis but only if the device is capable of that Feature Example : @Test public void ...
techiegul's user avatar
1 vote
0 answers
661 views

I have a utility class in my application that saves the User data from the server onto the SharedPreferences. I was trying to test the utilty class which is named UserLocalStore.kt I wrote the ...
ravi's user avatar
  • 1,012
0 votes
2 answers
682 views

How can I submit some text to SearchView in androidTest? onView(withId(R.id.search_src_text)).perform(typeText("text")) doesn't work for me - app crashes at this line @Test fun ...
user924's user avatar
  • 12.9k
8 votes
0 answers
2k views

I'm working on a multi-module project, and after making the transition from the support libraries to AndroidX, ./gradlew connectedCheck fails: FAILURE: Build failed with an exception. * What went ...
Justin Pollard's user avatar
1 vote
1 answer
607 views

I suspect my question is the same as this one, but the code there is incomplete and I must be missing something. Here's my test class: @RunWith(AndroidJUnit4::class) class MyTest { companion ...
Big McLargeHuge's user avatar
1 vote
0 answers
183 views

I am trying to creating a privileged apk and have updated my Android.mk to set the privilege module to true. My apk is compiled on a linux build and not using Android Studio. I also have the following ...
Hars13's user avatar
  • 11
2 votes
0 answers
416 views

My connectedDebugAndroidTest fails with com.android.builder.testing.ConnectedDevice > No tests found.[SM-A310F - 7.0] FAILED No tests found. This usually means that your test classes are not ...
PhilLab's user avatar
  • 5,087
5 votes
1 answer
528 views

I'm trying to run unit tests using MockitoJUnitRunner; they run fine under Android Studio, but some (not all) tests fail when running in the command line - which is a big deal, I need to be able to ...
mgcaguioa's user avatar
  • 1,503
28 votes
2 answers
13k views

In my Android application, I want exclude some test cases in a package so that I used test task in build.gradle file. for example: apply plugin: 'com.android.library' test{ exclude '**/calltest/...
M.A.Murali's user avatar
  • 10.2k
1 vote
1 answer
2k views

Is anyone aware of a sample project that shows how to get test orchestrator working? I checked the google samples and there doesn't seem to be a good sample project that shows test orchestrator. ...
Jon's user avatar
  • 1,529
21 votes
2 answers
5k views

I am trying to write a Robolectric test. I was following few tutorials where they seem to be using @RunWith(RobolectricTestRunner::class) @Config(constants = BuildConfig::class) to setup the test, ...
erluxman's user avatar
  • 19.6k
3 votes
2 answers
1k views

When I try to add dependency on AndroidX Test JUnit 1.0.0-beta01: androidTestImplementation androidx.test.ext:junit:1.0.0-beta01, Gradle Sync fails with the following error: Failed to resolve: org....
qwertyfinger's user avatar
16 votes
1 answer
13k views

In my Android application I have several test classes. If I run following command ./gradlew connectedAndroidTest it runs all the test cases inside the android test folder and generate test report for ...
M.A.Murali's user avatar
  • 10.2k
13 votes
1 answer
4k views

I have the following test, where the test name is with space and backtick for my instrumental test @RunWith(AndroidJUnit4::class) class MyTestClass { @Rule @JvmField var activityRule: ...
Elye's user avatar
  • 61.3k
0 votes
1 answer
260 views

I'm getting color (i.e. R.color.my_white is FFFFFFFF ) from my resource as below ContextCompat.getColor(getContext(), R.color.my_white) And when I perform AndroidJUnit4 testing, I also get the same ...
Elye's user avatar
  • 61.3k
8 votes
1 answer
4k views

I'm using the AndroidJUnitRunner in my project, but the unit tests are painfully slow to execute on a device and emulator both in Android Studio and from the command-line via gradlew. I'm using the ...
Sean Barbeau's user avatar
  • 11.8k
7 votes
0 answers
241 views

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 ...
dvdciri's user avatar
  • 451
1 vote
1 answer
6k views

I'm writing a jUnit test for a calculation function double calculate(double val1, double val2); The function is expected to return the same result if the inputs are "flipped", i.e. it shouldn't ...
Magnus's user avatar
  • 19.1k
3 votes
3 answers
3k views

Consider below code. How can I test this without using third party libraries? The Assert line is never executed, because it is a different thread and the vm stops running. Many thanks! public class ...
Jim Clermonts's user avatar
0 votes
1 answer
1k views

I've implemented my first testcase for my App. Before every testcase, I need to login using Firebase. I've programmed everything in my Firebase class using the Tasks API. The Firebase class is ...
Jim Clermonts's user avatar
2 votes
1 answer
1k views

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 ...
M.A.Murali's user avatar
  • 10.2k
0 votes
0 answers
520 views

I have a class called CallWcfTask that extended from extends AsyncTask<Void, Void, Void>. I have declared these fields: private String _CiName; private CallWcfCallBack wcfCallBack; private ...
Cyrus the Great's user avatar
2 votes
2 answers
3k views

Now with the release of JUnit 5.0 I'm struggling to get code coverage data using jacoco. My project is multi-module and my problem is that there is no exec file created for each module. Only one in ...
Alix's user avatar
  • 2,886