温故而知新。实践出真知。

robotium V2.2与V1.7.1导出API的差异整理

上一篇 / 下一篇  2011-04-10 17:48:20 / 个人分类:测试工具

一、删除:
int getCurrenButtonsCount()
          Deprecated. legacy method that is outdated


二、新增:
Solo(android.app.Instrumentation instrumentation)
          Constructor that takes in the instrumentation.

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

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, int match, int time)
          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 enterText(android.widget.EditText editText, String text)
          Enters text into a given EditText.

android.widget.Button getButton(String text)
          Returns a Button which shows a given text.

ArrayList<android.widget.DatePicker> getCurrentDatePickers()
          Returns an ArrayList of the DatePicker objects currently shown in the focused Activity or Dialog.

ArrayList<android.widget.ProgressBar> getCurrentProgressBars()
          Returns an ArrayList of the ProgressBar objects currently shown in the focused Activity or Dialog.


ArrayList<android.widget.SlidingDrawer> getCurrentSlidingDrawers()
          Returns an ArrayList of the SlidingDrawer objects currently shown in the focused Activity or Dialog.

ArrayList<android.widget.TimePicker> getCurrentTimePickers()
          Returns an ArrayList of the TimePicker objects currently shown in the focused Activity or Dialog.

ArrayList<android.view.View> getCurrentViews()
          Returns an ArrayList of the View objects currently shown in the focused Activity or Dialog.

android.widget.EditText getEditText(String text)
          Returns an EditText which shows a given text.

android.widget.TextView getText(String text)
          Returns a TextView which shows a given text.

android.view.View getView(int id)
          Returns a View with a given id. 
ArrayList<android.view.View> getViews(android.view.View parent)
          Returns an ArrayList of the View objects contained in the parent View.

void pressMenuItem(int index, int itemsPerRow)
          Presses a MenuItem with a given index.

boolean isCheckBoxChecked(String text)
          Checks if a CheckBox with a given text is checked.
boolean isRadioButtonChecked(String text)
          Checks if a RadioButton with a given text is checked.


boolean isSpinnerTextSelected(int index, String text)
          Checks if a given text is selected in a given Spinner.
boolean isSpinnerTextSelected(String text)
          Checks if a given text is selected in any Spinner located in the current screen.


boolean isTextChecked(String text)
          Checks if the given text is checked.


boolean isToggleButtonChecked(int index)
          Checks if a ToggleButton with a given index is checked.
boolean isToggleButtonChecked(String text)
          Checks if a ToggleButton with a given text is checked.



boolean searchButton(String text, boolean onlyVisible)
          Searches for a Button with the given text string and returns true if at least one Button is found.

boolean searchButton(String text, int minimumNumberOfMatches, boolean onlyVisible)
          Searches for a Button with the given text string and returns true if the searched Button is found a given number of times.

boolean searchToggleButton(String text)
          Searches for a ToggleButton with the given text string and returns true if at least one ToggleButton is found.
boolean searchToggleButton(String text, int minimumNumberOfMatches)
          Searches for a ToggleButton with the given text string and returns true if the searched ToggleButton is found a given number of times.


void setDatePicker(android.widget.DatePicker datePicker, int year, int monthOfYear, int dayOfMonth)
          Sets the date in a given DatePicker.

void setDatePicker(int index, int year, int monthOfYear, int dayOfMonth)
          Sets the date in a DatePicker with a given index.

void setProgressBar(int index, int progress)
          Sets the progress of a ProgressBar with a given index.

void setProgressBar(android.widget.ProgressBar progressBar, int progress)
          Sets the progress of a given ProgressBar.

void setSlidingDrawer(int index, int status)
          Sets the status of a SlidingDrawer with a given index.

void setSlidingDrawer(android.widget.SlidingDrawer slidingDrawer, int status)
          Sets the status of a given SlidingDrawer.

void setTimePicker(int index, int hour, int minute)
          Sets the time in a TimePicker with a given index.

void setTimePicker(android.widget.TimePicker timePicker, int hour, int minute)
          Sets the time in a given TimePicker.

<T extends android.view.View>
boolean waitForView(Class<T> viewClass)
          Waits for a View to be shown.

<T extends android.view.View>
boolean waitForView(Class<T> viewClass, int minimumNumberOfMatches, int timeout)
          Waits for a View to be shown.

<T extends android.view.View>
boolean waitForView(Class<T> viewClass, int minimumNumberOfMatches, int timeout, boolean scroll)
          Waits for a View to be shown.



三、修改了参数名或函数功能描述,使语义更严谨。

比如(“/* */”内的文字为1.7版本的描述):
ArrayList<android.widget.ToggleButton> getCurrentToggleButtons()
          Returns an ArrayList of the ToggleButton objects currently shown in the focused Activity or Dialog.
         /*Returns an ArrayList with the toggle buttons located in the current activity.*/

ArrayList<android.view.View> getViews()
          Returns an ArrayList of all the View objects located in the focused Activity or Dialog.
         /*Returns an ArrayList of all the views located in the current activity.*/

boolean scrollUpList(int index/*listIndex*/)
          Scrolls up a list with a given index.

boolean searchButton(String text/*int search*/)
          Searches for a Button with the given text string and returns true if at least one Button is found.
        /*Searches for a button with the given search string and returns true if at least one button is found with the expected text.*/

boolean searchButton(String text/*int search*/, int minimumNumberOfMatches/*int matches*/)
          Searches for a Button with the given text string and returns true if the searched Button is found a given number of times.

boolean waitForText(String text, int minimumNumberOfMatches /*int matches*/, long timeout)
          Waits for a text to be shown.

boolean waitForText(String text, int minimumNumberOfMatches/*int matches*/, long timeout, boolean scroll)
          Waits for a text to be shown.

boolean searchToggleButton(String text, int minimumNumberOfMatches/*int matches*/)
          Searches for a ToggleButton with the given text string and returns true if the searched ToggleButton is found a given number of times.


TAG: robotium

 

评分:0

我来说两句

Open Toolbar