dimanche 3 avril 2016

Android: Runtime error while UiTesting

I am trying to run a Ui test, and everytime I run the applicatoin it gives the following error in the console and closes the app that is running. I have the uiautomator.jar, android.jar & JUnit4 libraries imported. Im using Eclipse. What am I missing here?

[2016-04-04 04:44:00 - UiTests] Test run failed: Instrumentation run failed due to 'java.lang.RuntimeException'

TestClass

package android.support.v7.appcompat.test;

import com.android.uiautomator.core.UiObject;
import com.android.uiautomator.core.UiObjectNotFoundException;
import com.android.uiautomator.core.UiSelector;
import com.android.uiautomator.testrunner.UiAutomatorTestCase;

public class DMTest extends UiAutomatorTestCase
{
    public void testDemo() throws UiObjectNotFoundException
    {
        // setText
        new UiObject(new UiSelector().description("edittext_brute")).setText("bazinga");

        // clickButton
        //new UiObject(new UiSelector().description("button_done")).click();

        UiObject btDone = new UiObject(new UiSelector().description("button_done"));
        btDone.click();
    }

}

Manifest

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://ift.tt/nIICcg"
    package="android.support.v7.appcompat.test"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="14" />

    <instrumentation
    android:name="android.test.InstrumentationTestRunner"
    android:targetPackage="com.example.sony.reel" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <uses-library android:name="android.test.runner" />
    </application>

</manifest>

Aucun commentaire:

Enregistrer un commentaire