android junit入门(二)Activity测试
测试ACTIVITY
直接上类了
public class TestActivity extendsActivityInstrumentationTestCase2<Test1Activity> {private Test1Activity mActivity; // the activity under testprivate TextView mView; // the activity's TextView (the only view)private String resourceString;public TestActivity() {super("rod.fasdf", Test1Activity.class);}@Overrideprotected void setUp() throws Exception {super.setUp();mActivity = getActivity();mView = (TextView) mActivity.findViewById(R.id.test_id);resourceString = mActivity.getString(R.string.hello);}public void testPreconditions() {assertNotNull(mView);}public void testText() {assertEquals(resourceString, (String) mView.getText());}}