android-espresso

Android Espresso: “No test were found” , “Process crashed”

你离开我真会死。 提交于 2020-08-27 18:48:33
问题 When testing my Android app with Espresso, I noticed that running an AndroidTest configured with All in Module finds no tests, while running All in Package succeeds. I created the following reproducible case: Use wizard to create new clean application with minSdk 8 and empty Activity Configure gradle with espresso dependencies etc. (see below) Create AndroidTest Run Configuration with option All in Module and one with All in Package Add class with tests (see below) Run with All in Package :

Android UI tests with Espresso + MockK crash with SIGSEGV on emulators, fine on physical devices

…衆ロ難τιáo~ 提交于 2020-08-08 05:14:10
问题 I have just started using MockK to mock all the Repositories / Services logic in an MVP-based app for UI tests. I have some UI tests running a login activity where the Espresso inputs logins and passwords and using MockK I can fake various situation where the login fails or not. All services & repositories are standard Kotlin object, so I am using mockkobject and every/coEvery to override and handle login requests & tasks. On my physical devices, there are no issues with the tests at all, but

Android Espresso does not have a NavController set Error

[亡魂溺海] 提交于 2020-07-23 06:52:16
问题 I am trying to test a fragment in my navigation architecture and my test is as follows: test.kt @RunWith(AndroidJUnit4::class) @MediumTest internal class AddingAccountTest{ @get:Rule var activityRule: ActivityTestRule<MainActivity> = ActivityTestRule(MainActivity::class.java) @Before fun loadCorrespondingFragment(){ } @Test fun checkThatAllFieldsInFormAreEmpty(){ // Create a TestNavHostController val navController = TestNavHostController(ApplicationProvider.getApplicationContext())

Android Espresso does not have a NavController set Error

我是研究僧i 提交于 2020-07-23 06:51:19
问题 I am trying to test a fragment in my navigation architecture and my test is as follows: test.kt @RunWith(AndroidJUnit4::class) @MediumTest internal class AddingAccountTest{ @get:Rule var activityRule: ActivityTestRule<MainActivity> = ActivityTestRule(MainActivity::class.java) @Before fun loadCorrespondingFragment(){ } @Test fun checkThatAllFieldsInFormAreEmpty(){ // Create a TestNavHostController val navController = TestNavHostController(ApplicationProvider.getApplicationContext())

RecyclerView Espresso Testing Fails Due to RunTimeException

删除回忆录丶 提交于 2020-07-10 06:43:23
问题 I have the following code I am using, trying to set up Espresso: import android.support.test.espresso.Espresso; import android.support.test.espresso.contrib.RecyclerViewActions; import android.support.test.espresso.matcher.ViewMatchers; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import static android.support.test.espresso.action.ViewActions.click; @RunWith

Clear database before testcase espresso

余生长醉 提交于 2020-07-08 11:39:18
问题 im using espresso to clear database in my app Im setting activity like this @Rule @JvmField val activity = ActivityTestRule<PhotoPrinterActivity>(PhotoPrinterActivity::class.java,false,false) And this is my before function @Before open fun setup() { clearDatabase() activity.launchActivity(null) // Waiting for start app success fully } And this is my clear database code fun clearDatabase() { val databaseList = InstrumentationRegistry.getInstrumentation().targetContext.databaseList() for

Unresolved reference ActivityTestRule for AndroidX

扶醉桌前 提交于 2020-06-24 19:49:49
问题 I'm trying to test my UI via instrumentation test, with androidX espresso library. In my grade I have: apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: "kotlin-kapt" android { compileSdkVersion 28 defaultConfig { applicationId "it.zehus.mybike" minSdkVersion 21 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" android.defaultConfig