Android系统单元测试方法(23)
发表于:2011-06-30来源:未知作者:领测软件测试网采编点击数:
标签:
* public class TestNewActivity extends *ActivityInstrumentationTestCase2NewActivity{ * private Buttonbutton1= null ; * private Buttonbutton2= null ; * private NewActivitynewActivity= null ; * public T
* public class TestNewActivity extends
* ActivityInstrumentationTestCase2<NewActivity> {
* private Button button1 = null;
* private Button button2 = null;
* private NewActivity newActivity = null;
* public TestNewActivity() {
* super("cc.androidos.activity", NewActivity.class);
*
*
* }
*
* @Override
* protected void setUp() throws Exception {
* String tag = "setUp";
* Log.e(tag, "init all var....");
* newActivity = getActivity();
* button1 = (Button) newActivity.findViewById(R.id.Button01);
* button2 = (Button) newActivity.findViewById(R.id.Button02);
* }
*
* public void testButtonFocus() {
* String tag = "testButtonFocus";
* Log.e(tag, "start the button focus...");
* assertTrue("Button1 is focused", button1.isFocused());
* Log.e(tag, "send the down key event...");
* sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
* assertTrue(
原文转自:http://www.ltesting.net