I have started learning about UIAutomator in eclipse based on http://university.utest.com/android-ui-testing-uiautomatorviewer-and-uiautomator/. When I wrote a simple code like this:
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();
}
}
I get error that getUIDevice() is undefined for the type test. How to improve this?