编译UIautomator时出错

时间:2015-07-30 18:58:19

标签: android eclipse uiautomator android-uiautomator

我已经开始基于http://university.utest.com/android-ui-testing-uiautomatorviewer-and-uiautomator/在eclipse中学习UIAutomator了。当我写这样一个简单的代码时:

import static org.junit.Assert.*;

import com.android.uiautomator.core.UiDevice;
import com.android.uiautomator.core.UiObject;

import com.android.uiautomator.testrunner.UiAutomatorTestCase;

import com.android.uiautomator.core.UiSelector;

import com.android.uiautomator.core.UiObjectNotFoundException;

import com.android.uiautomator.core.UiScrollable;

import org.junit.Test;

public class test {



@Test
public void test() {
    fail("Not yet implemented");
    getUiDevice().pressHome();
}

}

我得到的错误是getUIDevice()未定义类型测试。如何改善这个?

1 个答案:

答案 0 :(得分:0)

您的测试类必须扩展UiAutomatorTestCase