- Let's change the app to disable the button…once you click on it.…In main activity in line nine, we are going to…go ahead and store the button as a variable.…Put your cursor on line nine,…press command D to duplicate it.…Change the name to greet button, and the type to be view.…
Then, put your cursor on line 15 and press command D…to duplicate it.…On line 15 we will be looking for the greet button.…greetButton = findViewById(R.id.greet_button)…Now that we have the greet button,…we will disable it in the greet function.…Inside the greet function on line 20,…add greetButton.isEnabled = false…This means that after the user clicks on the greet button…we want it to be disabled.…
Let's take a look by running the test.…Choose the target app, then click the green button.…In the app, click on the greet button.…Just like before, the string hello is displayed,…and the greet button is also disabled.…Now, let's verify that in the test.…Go back to main activity, press command shift T,…and choose main activity test to switch to it.…
- Advantages of Espresso and automated testing
- Adding Espresso to an Android project
- Creating your first test
- Recording actions in the Test Recorder
- Pinpointing a view
- Testing list views
- Testing recycler views
Skill Level Beginner
Android App Development: Data Persistence Librarieswith Annyce Davis4h 52m Intermediate
Effective Android Testing for Mobile Developerswith Chiu-Ki Chan2h 56m Intermediate
Advanced Android Espresso Testingwith Chiu-Ki Chan1h 37m Advanced
1. What Is Espresso?
2. Your First Espresso Test
3. Espresso Test Recorder
4. Pinpointing a View
5. List View
6. Recycler View
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.