使用Robotium对Android自动化测试出现问题,本人新手,请大侠们帮忙啊
Test run failed: Unable to find instrumentation info for: ComponentInfo{com.calculator/android.test.InstrumentationTestRunner}测试的是只有APK的应用,没有源码,基于源码的Robotium自动化测试已经调试成功,现在在调试没有源码,只有apk的自动化用例。
测试的是calculator
包名:com.calculator
activity:com.calculator.Main
package com.calculator;
import com.jayway.android.robotium.solo.Solo;
import android.test.ActivityInstrumentationTestCase2;
@SuppressWarnings("unchecked")
public class calculatortest extends ActivityInstrumentationTestCase2{
private static final String TARGET_PACKAGE_ID="com.calculator";
private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME="com.calculator.Main";
private static Class launcherActivityClass;
static{
try
{
launcherActivityClass=Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
} catch (ClassNotFoundException e){
throw new RuntimeException(e);
}
}
public calculatortest()throws ClassNotFoundException{
super(TARGET_PACKAGE_ID,launcherActivityClass);
}
private Solo solo;
@Override
public void setUp() throws Exception{
solo = new Solo(getInstrumentation(),getActivity());
}
public void testDisplayBlackBox() throws Exception{
//Enter any integer/decimal value for first editfield, we are writing 10
solo.enterText(0, "10");
//Enter any interger/decimal value for first editfield, we are writing 20
solo.enterText(1, "20");
//Click on Multiply button
solo.clickOnButton("Multiply");
//Verify that resultant of 10 x 20
assertTrue(solo.searchText("200"));
}
@Override
public void tearDown() throws Exception {
try {
solo.finalize(); //Robotium will finish all the activities that have been open
} catch (Throwable e) {
e.printStackTrace();
}
getActivity().finish();
super.tearDown();
}
} 各路大侠,请多多帮忙啊,小人刚开始做Android 自动化测试才一周,菜鸟中的菜鸟 Manifest文件如下:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.calculator"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" />
<instrumentation android:targetPackage="com.calculator" android:name="android.test.InstrumentationTestRunner" />"
<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:name="android.test.runner" />
</application>
</manifest> 路过的高手,停下来稍作休息,给讲解一下呗 Robotium小白,顶贴
页:
[1]