0
我有一個Android項目想自動化。Android Robotium找不到測試用例
我創建了一個Robotium項目呢,這裏一個TestCase是:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nu.art.software.cyborg.automation.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<application
android:icon="@drawable/icon"
android:label="@string/app_name" >
<uses-library android:name="android.test.runner" />
</application>
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.nu.art.software.android.services" />
</manifest>
:
package com.nu.art.software.cyborg.automation.test;
import android.app.Instrumentation;
import android.content.Context;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.Smoke;
import com.nu.art.software.cyborg.automation.core.AutomationManager;
import com.nu.art.software.cyborg.core.ApplicationLauncher;
import com.nu.art.software.cyborg.log.Log;
import com.nu.art.software.cyborg.log.Logger;
import com.nu.art.software.cyborg.modules.automation.AutomationScenario;
import com.nu.art.software.rexml.core.ReXML;
public class TestCase
extends ActivityInstrumentationTestCase2<ApplicationLauncher>
implements Logger {
private AutomationScenario automationScenario;
private Context context;
private Context targetContext;
protected AutomationManager manager;
protected final String TAG = getClass().getSimpleName();
public TestCase() {
super(ApplicationLauncher.class);
}
@Override
public final void setUp()
throws Exception {
Instrumentation instrumentation = getInstrumentation();
context = instrumentation.getContext();
targetContext = instrumentation.getTargetContext();
automationScenario = ReXML.getSystemReXML().deserialize(AutomationScenario.class, context.getAssets().open("user_scenario.xml"));
manager = new AutomationManager();
manager.setInstrumentation(instrumentation);
manager.init();
}
@Smoke
// @SmallTest
public void runScenario()
throws Exception {
try {
manager.executeScenario(automationScenario);
} catch (Exception e) {
logError(e);
throw e;
}
}
/** Some log methods **/
}
在清單中定義的項目包,其中TastCase奠定包匹配
我確定它不承認因爲這個測試:
有什麼我失蹤?
在此先感謝,
亞當。
你是100%正確的......我習慣了JSystem,並且我忘記了JUnit有這個愚蠢的要求,並且我預計Google會更聰明......我的壞... – TacB0sS 2012-04-20 12:23:30