December 2013
Beginner
416 pages
12h 45m
English
Next you want to test the lifecycle of the activity. The instrumentation provides a method to move the activity from one state to another, where you can test various conditions.
1. Create a new test method named testOnResume. Inside this test, obtain each view by calling findViewById. Set the activity to the resume state by calling callActivityOnResume. Then assert that the counter text contains "0:00:00" and that the Stop and Photo buttons are enabled and the Start button is disabled (see Listing 10.28).
Listing 10.28 Testing Initial UI After onResume in an Activity Is Called
public void testOnResume() { TextView counter = (TextView) activity.findViewById(R.id.timer); Button ...
Read now
Unlock full access