现在的位置: 首页 > 综合 > 正文

Android Robitium Solo语法知识

2013年11月10日 ⁄ 综合 ⁄ 共 3847字 ⁄ 字号 评论关闭

 


Package 

 Class 

Use 

Tree 

Deprecated 

Index 

Help 

 

 PREV CLASS   NEXT CLASS

FRAMES
   NO FRAMES    All
Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


com.jayway.android.robotium.solo
Class Solo

java.lang.Object

 com.jayway.android.robotium.solo.Solo


public classSolo

extendsObject

This class contains all the methods that the sub-classes have. It supports test cases that span over multiple activities.
Robotium has full support for Activities, Dialogs, Toasts, Menus and Context Menus. When writing tests there is no need to plan for or expect new activities in the test case. All is handled automatically by Robotium-Solo. Robotium-Solo can be used in conjunction
with ActivityInstrumentationTestCase2. The test cases are written from a user perspective were technical details are not needed. Example of usage (test case spanning over multiple activities):

 

 public void setUp() throws Exception {

 solo = new Solo(getInstrumentation(), getActivity());

 }

 

 public void testTextShows() throws Exception {

 

 solo.clickOnText("Categories");

 solo.clickOnText("Other");

 solo.clickOnButton("Edit");

 solo.searchText("Edit Window");

 solo.clickOnButton("Commit");

 assertTrue(solo.searchText("Changes have been made successfully"));

 }

 

 

Author:

Renas Reda, renas.reda@jayway.com


Field Summary

static int

DELETE
           

static int

DOWN
           

static int

ENTER
           

static int

LANDSCAPE
           

static int

LEFT
           

static int

MENU
           

static int

PORTRAIT
           

static int

RIGHT
           

static int

UP
           

 

Constructor Summary

Solo(android.app.Instrumentation inst,
android.app.Activity activity)
          Constructor that takes in the instrumentation and the start activity.

 

 

Method Summary

 void

assertCurrentActivity(String message,Class expectedClass)

          Asserts that the expected Activity is the currently active one.

 void

assertCurrentActivity(String message,Class expectedClass,
boolean isNewInstance)
          Asserts that the expected Activity is the currently active one, with the possibility to verify that the expected Activity is a new instance of the Activity.

 void

assertCurrentActivity(String message,String name)

          Asserts that the expected Activity is the currently active one.

 void

assertCurrentActivity(String message,String name,
boolean isNewInstance)
          Asserts that the expected Activity is the currently active one, with the possibility to verify that the expected Activity is a new instance of the Activity.

 void

assertMemoryNotLow()
          Asserts that the available memory in the system is not low.

 void

clearEditText(android.widget.EditText editText)
          Clears the value of an EditText.

 void

clearEditText(int index)
          Clears the value of an EditText.

 ArrayList<android.widget.TextView>

clickInList(int line)
          Clicks on a given list line and returns an ArrayList of the TextView objects that the list line is showing.

 ArrayList<android.widget.TextView>

clickInList(int line,
int index)
          Clicks on a given list line on a specified list and returns an ArrayList of the TextView objects that the list line is showing.

 void

clickLongOnScreen(float x,
float y)
          Long clicks a given coordinate on the screen.

 void

clickLongOnScreen(float x,
float y, int time)
          Long clicks a given coordinate on the screen for a given amount of time.

 void

clickLongOnText(String text)
          Long clicks on a given View.

 void

clickLongOnText(String text,
int match)
          Long clicks on a given View.

 void

clickLongOnText(String text,
int match, boolean scroll)
          Long clicks on a given View.

 void

clickLongOnText(String text,
int match, int time)
          Long clicks on a given View.

 void

clickLongOnTextAndPress(String text,
int index)
          Long clicks on a given View and then selects an item from the context menu that appears.

 void

clickLongOnView(android.view.View view)
          Long clicks on a given View.

 void

clickLongOnView(android.view.View view,
int time)
          Long clicks on a given View for a given amount of time.

 void

clickOnButton(int index)
          Clicks on a Button with a given index.

 void

clickOnButton(String name)
          Clicks on a Button with a given text.

 void

clickOnCheckBox

抱歉!评论已关闭.