android junit入门(二)Activity测试
测试ACTIVITY
直接上类了
public class TestActivity extends ActivityInstrumentationTestCase2<Test1Activity> { private Test1Activity mActivity; // the activity under test private TextView mView; // the activity's TextView (the only view) private String resourceString; public TestActivity() { super("rod.fasdf", Test1Activity.class); } @Override protected 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()); } }
相关推荐
shirleypaddy 2020-10-19
qingmumu 2020-10-19
lustdevil 2020-10-18
ganlulululu 2020-10-12
lustdevil 2020-08-03
lustdevil 2020-07-18
lustdevil 2020-06-25
lustdevil 2020-06-21
zhengzf0 2020-06-21
宿命java 2020-06-15
JackYin 2020-06-14
dongxurr 2020-06-07
snowphy 2020-06-06
zhengzf0 2020-05-28
81901836 2020-05-26
Julywhj 2020-05-26