I'm actually trying to implement a simple test suite within an AndroidJunit Test project which uses the following class
- UiObject
- UiSelector
- UiAutomatorTestcase
to click and open the Messaging application on the Android Device and run it as AndroidJunit Test in Eclipse.
While running the code I'm get the following exception
java.lang.RuntimeException: Stub!
I don't understand where I'm going wrong. Please let me know whether we can run the UiAutomatorTestcase test suite using the AndroidJuint Test project or not.
Here is the sample code and the failure trace
public class UiautomatorTest extends
ActivityInstrumentationTestCase2<MyMainActivity> {
UiAutomatorTestCase mUiAutomatorTestCase;
public UiautomatorTest() {
super(MyMainActivity.class);`enter code here`
// TODO Auto-generated constructor stub
}
@Override
protected void setUp() throws Exception {
// TODO Auto-generated method stub
super.setUp();
mUiAutomatorTestCase = new UiAutomatorTestCase();
}
public void testToOpenMessageApp() throws UiObjectNotFoundException {
UiObject message = new UiObject(
new UiSelector().description("Messaging"));
message.clickAndWaitForNewWindow();
UiObject composeMessage = new UiObject(
new UiSelector().description("compose"));
composeMessage.clickAndWaitForNewWindow();
UiObject typeMessage = new UiObject(
new UiSelector().description("Type Message"));
typeMessage.clickAndWaitForNewWindow();
mUiAutomatorTestCase.getUiDevice().pressHome();
}
}
The stacktrace
java.lang.RuntimeException: Stub!
at mypackagename.UiAutomatorTestCase.<init>(UiAutomatorTestCase.java:5)
at mypackagename..setUp(UiautomatorTest.java:25)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1584)