* import android.test.ActivityInstrumentationTestCase2;
* import android.util.Log;
* import android.view.KeyEvent;
* import android.widget.Button;
* public class TestNewActivity extends
* ActivityInstrumentationTestCase2
* private Button button1 = null;
* private Button button2 = null;
* private NewActivity newActivity = null;
* public TestNewActivity() {
* super("cc.androidos.activity", NewActivity.class);
* //This first parameter should the Activity package
* //if other , the junit give us the exception: unable resolve the activity
* }
*
* @Override
* protected void setUp() throws Exception {
* String tag = "setUp";
* Log.e(tag, "init all var....");
* newActivity = getActivity();
* button1 = (Button) newActivity.findViewById(R.id.Button01);
文章來源于領測軟件測試網 http://www.kjueaiud.com/