简体   繁体   中英

class not found during run test with uiautomator

There is my class:

package org.akovtunenko.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 LoginGmailTest extends UiAutomatorTestCase {

    public void testClick() throws UiObjectNotFoundException
    {
        UiObject seven = new UiObject(new UiSelector().resourceId("com.slice.qa:id/btnLogin"));
        seven.click();
        getUiDevice().pressBack();
    }
}

I exported jar file using Eclipse and push it to my Android device.

Where I run this class in this way

adb shell  uiautomator runtest /mnt/sdcard/accept.jar -c org.akovtunenko.test.LoginGmailTest

I got error:

INSTRUMENTATION_RESULT: shortMsg=java.lang.RuntimeException INSTRUMENTATION_RESULT: longMsg=Didn't find class "org.akovtunenko.test.LoginGmailTest" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/uiautomator.jar", zip file "/mnt/sdcard/accept.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] INSTRUMENTATION_CODE: 0

How can I run test class on my android device?

我使用uibuild.xml和ant使用命令android create project进行构建

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM