我正在使用 robotium 来测试我的应用程序。问题出在 solo.searchText 函数上。在我的应用程序中,我使用 expandale listview 来显示类别值。在使用 robotium 进行测试时,我正在交叉检查是否所有类别都存在。我正在为此使用以下代码。
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条件,测试到此为止。我怎样才能让它滚动?请帮我。我坚持这个。
最佳答案
根据我的经验,在搜索文本时,solo 总是向下滚动。它不会向上滚动。如果您的问题是由于在搜索一个值时滚动到底部引起的,那么解决方案是始终在调用 searchText() 之前调用 solo.scrollListToTop(listIndex) 。
关于android - solo.search text() 不滚动可扩展列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19700146/