0

I have an Android project I want to automate.

I have created a Robotium project for it, and a TestCase here it is:

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  **/
}

The project package defined in the manifest matches the package where the TastCase lays:

<?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>

I'm sure it does not recognize the test because of this:

enter image description here

Is there something I'm missing?

Thanks in advance,

Adam.

4

1 に答える 1

2

Your test cases need to start with test. Example is testRunScenario().

于 2012-04-20T05:35:03.723 に答える