Retry TestRule for Android Espresso tests

This tutorial shows how to add Retry Test Rule to your Espresso UI automation tests. If a test fails it will retry test ‘X’ times. The code snippets are for Java and Kotlin projects.

1. First, we create the Retry TestRule

Kotlin: