To start testing with Espresso, first you need to add the espresso dependency in your app level build.gradle.

testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile com.android.support.test.espresso:espresso-core:2.2.2

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: @+id/login_button . Your Simple Espresso Test Class would look like:

public class Your_Class_Name_EspressoTest {
	@Rule
	public ActivityTestRule<Your_Class_Name> mActivityRule =
            new ActivityTestRule<>(Your_Class_Name);

	@Test
	public void ensureButtonDisableAfterOneClick() {
        onView(withId(R.id.username)).perform(ViewActions.clearText())
                .perform(ViewActions.typeText(My Name),closeSoftKeyboard());
        onView(withId(R.id.login_button)).perform(click());
        onView(withId(R.id.login_button)).check(matches(not(isEnabled())));
    }
}

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.