使用uiautomator在运行测试期间找不到类

时间:2015-11-03 08:07:16

标签: java android

有我的班级:

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();
    }
}

我使用Eclipse导出jar文件并将其推送到我的Android设备。

我以这种方式运行这个课程

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

我收到了错误:

  

INSTRUMENTATION_RESULT:shortMsg = java.lang.RuntimeException   INSTRUMENTATION_RESULT:longMsg =找不到类" org.akovtunenko.test.LoginGmailTest"在路径上:DexPathList [[zip文件" /system/framework/android.test.runner.jar" ;, zip文件" /system/framework/uiautomator.jar" ;, zip文件&# 34; /mnt/sdcard/accept.jar"],nativeLibraryDirectories = [/ vendor / lib,/ system / lib]]   INSTRUMENTATION_CODE:0

如何在我的Android设备上运行测试类?

1 个答案:

答案 0 :(得分:0)

我使用命令android create project

使用uibuild.xml和ant构建