levibostian / AndroidBlanky

Create a new Android app fast. Comes pre-installed with libraries you already use.
7 stars 0 forks source link

Integration testing UI code without UI testing on device #59

Closed levibostian closed 2 years ago

levibostian commented 4 years ago

I have been writing a lot of iOS testing code lately. When testing the UI of my iOS projects, I write unit tests to test a View of my app, "When this button is pressed, this view is shown and this one is not". I then use UI tests to test certain situations such as going through a whole login flow and also to make sure that a view looks good at all of the different screens.

I was thinking about doing the same on Android. Having UI tests:

Lower the number of UI tests down and number of integration tests up through the ability to integration test UI code.

My idea for this is to use Robolectric. It has the ability to run on device or not with it's integration with Android Jetpack and Espresso's API.

UI tests run on device and take screenshots while robolectric tests are integration tests.

Search this repo for uses of "robolectric" to find it's uses of robolectric. Maybe a good start would be to run the samples repo on my local machine to see how well it works?