2010-02-19 44 views

回答

7

自从Calculon还处于非常早期阶段以后,我会和Robotium一起去。下面是Calculon的作者评论:

那么现在它只是一堆,我掏出另一个项目的源代码文件...请注意,这个库仍然是一个非常 雏形初现。其API可能会改变 。 Source

我已经和Robotium一起玩过,它绝对使得写作功能测试变得有趣。为了给你一个想法,这里有来自API的几个方法亮点:

  • clickOnButton,clickOnText
  • enterText
  • getCurrentButtons,getCurrentEditTexts,getCurrentImageViews,getCurrentSpinners,getCurrentTextViews
  • pressMenuItem,pressSpinnerItem
  • searchText,searchEditText,searchButton

这是一个代码示例f ROM中的入门指南:

public void testTextIsSaved() throws Exception { 
    solo.clickOnText("Other"); 
    solo.clickOnButton("Edit"); 
    assertTrue(solo.searchText("Edit Window")); 
    solo.enterText(1, "Some text for testing purposes") 
    solo.clickOnButton("Save"); 
    assertTrue(solo.searchText("Changes have been made successfully")); 
    solo.clickOnButton("Ok"); 
    assertTrue(solo.searchText("Some text for testing purposes"));} 

肯定会给它一个尝试,如果你打算写ActivityInstrumentationTestCase2类。查看Getting Started指南获取说明。

相关问题