0
我想用测试应用程序中的Instrumentation接口来测试我的应用程序。 我有一个自定义活动,我的每一个活动延伸。在此我要开始的仪器来获得程序的信息:仪器Android应用程序与启动仪器
public class BxActivity extends Activity {
@Override
protected void onResume() {
super.onResume();
...
boolean instru = startInstrumentation(new ComponentName(BxActivity.this, InstrumentationRobot.class), null, null);
恕我直言,这应该重新启动与在InstrumentationRobot.class仪器代码的应用程序。它在同一个Android项目和包中。
public class InstrumentationRobot extends Instrumentation {
@Override
public void onCreate(Bundle arguments) {
super.onCreate(arguments);
Log.v("InstrRobot", "Hello from Robot");
start();
}
我已经添加了仪器的清单如下:
<instrumentation
android:name="InstrumentationRobot" (class in the same pkg)
android:targetPackage="my.package.name" />
</application>
这是我的仪表正确的清单代码,所以我的小机器人打印出“你好”给我。
谢谢,soeren