android-testing

Best practices for Android Unit Testing?

你。 提交于 2020-12-28 06:50:28
问题 I am developing a mobile android app. What are the most common libraries/frameworks used for Android unit testing? I feel that most of the business logic, database testing, Web services testing can all be done using JUnit. However, what's the best approach for testing UI, the UI workflow, etc? For example, how can we test if the Android app launches a web browser successfully? Or how can we confirm if buttons, certain things are pressed successfully? Or if images are loaded successfully? 回答1:

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())