2

我正在使用robotium 来测试我的应用程序。问题在于 solo.searchText 功能。在我的应用程序中,我使用 expandale listview 来显示类别值。在使用机器人进行测试时,我正在交叉检查是否所有类别都存在。我正在使用下面的代码。

    boolean ifCategoryLoadingFailed = false; 
    for(String cat: UnitTestHelperSuite.getInstance().categories){              
        if(solo.searchText(cat,1,true)){
            //LogAdapter.verbose(TAG, "***********Found Category::"+ cat);
            UnitTestingFramework.expdata.exportResult("****","Found Category::"+cat,"Success");
            continue;
        }
        else{
            ifCategoryLoadingFailed = true;
            //LogAdapter.verbose(TAG, "***********Failed to Found Category::"+ cat);    
            UnitTestingFramework.expdata.exportResult("****","Found Category::"+cat,"Failed");
            break;
        }
    }

它以前工作正常。但是现在列表没有滚动。所以它只识别可见的类别。但它没有进入 else 条件。测试在这里停止。我怎样才能让它可滚动?请帮我。我被这个困住了。

4

1 回答 1

1

根据我的经验,搜索文本时,solo 总是向下滚动。但它不会向上滚动。如果您的问题是由于在搜索一个值时滚动到底部引起的,那么解决方案是始终在调用 searchText() 之前调用 solo.scrollListToTop(listIndex) 。

于 2013-11-19T20:07:50.657 回答