Guest User

Untitled

a guest
Jun 15th, 2014
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. import com.android.uiautomator.core.UiObject;
  2. import com.android.uiautomator.testrunner.UiAutomatorTestCase;
  3. import com.android.uiautomator.core.UiSelector;
  4. import com.android.uiautomator.core.UiObjectNotFoundException;
  5. import com.android.uiautomator.core.UiScrollable;
  6.  
  7. public class MyUITester extends UiAutomatorTestCase
  8. {
  9. public void testingCalculator() throws UiObjectNotFoundException
  10. {
  11. getUiDevice().pressHome();
  12. //System.out.println("testline1");
  13. UiObject Applications = new UiObject(new UiSelector().text("Apps"));
  14. Applications.clickAndWaitForNewWindow();
  15. UiScrollable ListOfapplications = new UiScrollable(new UiSelector().scrollable(true));
  16. UiObject Calculator = ListOfapplications.getChildByText(new UiSelector().className(android.widget.TextView.class.getName()),"Calculator");
  17. Calculator.clickAndWaitForNewWindow();
  18. UiObject seven = new UiObject(new UiSelector().resourceId("com.android.calculator2:id/digit7"));
  19. seven.click();
  20. UiObject plus = new UiObject(new UiSelector().resourceId("com.android.calculator2:id/plus"));
  21. plus.click();
  22. UiObject one = new UiObject(new UiSelector().resourceId("com.android.calculator2:id/digit1"));
  23. one.click();
  24. UiObject result = new UiObject(new UiSelector().resourceId("com.android.calculator2:id/equal"));
  25. result.click();
  26. getUiDevice().pressBack();
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment