Android Studio has a very useful tool, the Record Espresso Test. It records the action on your application and creates an instrumented class file. Go to Run > Record Espresso Test. Choose the deployment device and click OK. Your app will start and together it will open a window that shows your actions.
I typed Kronos. I also clicked Add assertion. Then I have to choose the view on the screen for the assertion. Select what type of matcher and the text.
I clicked Save Assertion and then OK. I have to specify the name of the test class file so Android Studio could create the file. Here is the file that has been created
The conclusion is that this tools is good to start an instrumented test, and skip a lot of coding 😛 Please notice that it is very slow while running on Linux. It was faster in a Windows machine.
- Android – Notifications
- Content Provider – Part 3 – insert, delete, update, getType
- Content Provider – Part 2 – create and query