To start testing with Espresso, first you need to add the espresso dependency in your
app level build.gradle.
Requirement: Check if a button is disabled or not after taking some input from Edittext and clicking the button once.
Suppose your Edittext Id is:
@+id/username and Button Id is:
Your Simple Espresso Test Class would look like:
So, first you define the rule and then write the test case for that class. Here we are first taking the input from Edittext and then performing click operation on Button. And then finally checking if the Button is disable now or not. The convention of putting this test class is under androidTest package at the same place where your relevant class is residing in the main package.