Android &引用;“重置”;机器人搜索文本
我在这里有一个独特的情况。我正在使用Robotium测试一个应用程序,我是在“黑盒”条件下进行测试的。在我的测试中,我有一个标题为“all”的选项卡,它位于屏幕顶部,我想测试一下,当它被单击时,所有可用的项目都会列出。但是发生的事情不是单击“全部”选项卡,而是单击名为“高级呼叫管理器”的应用程序。我认为这是因为“all”是“call”的一部分,而且由于Robotium的工作方式,它会点击“all”,即使它是“call”的一部分。看了我的代码之后,您可能会明白我的问题是什么 所以我的问题是: 有没有一种方法可以“重置”Robotium,以便它在搜索文本时从页面顶部开始?这是我的密码:Android &引用;“重置”;机器人搜索文本,android,testing,junit,automation,robotium,Android,Testing,Junit,Automation,Robotium,我在这里有一个独特的情况。我正在使用Robotium测试一个应用程序,我是在“黑盒”条件下进行测试的。在我的测试中,我有一个标题为“all”的选项卡,它位于屏幕顶部,我想测试一下,当它被单击时,所有可用的项目都会列出。但是发生的事情不是单击“全部”选项卡,而是单击名为“高级呼叫管理器”的应用程序。我认为这是因为“all”是“call”的一部分,而且由于Robotium的工作方式,它会点击“all”,即使它是“call”的一部分。看了我的代码之后,您可能会明白我的问题是什么 所以我的问题是: 有没
solo.waitForText("all");
bw.write("Verify presence of 'all' filter on " + BUSINESS + "-COMMUNICATION page\",\"");
if(solo.searchText("all")==false){
bw.write("FAILED \",\" \'all\' filter not found \"\n\"");
}else if(solo.searchText("all")==true){
bw.write("PASSED \",\" \'all\' filter present\"\n\"");
bw.write("Verify functionality of 'all' filter\",\"");
solo.clickOnText("all");
solo.sleep(5000);
solo.takeScreenshot();
bw.write("Screenshot taken\",\"" +"See photo: "+ photoFormat.format(new Date()).toString()+"\"\n\"");
}
任何帮助都将不胜感激 传递给solo.ClickContext()的字符串实际上是一个正则表达式。因此,我认为您可以通过传递一个匹配'all'但不匹配'call'的正则表达式来解决您的问题
ViewGroup class will be helpful in this case as you are using tabs in your code.Now find the view using getChildAt() method.
ViewGroup tabs = (ViewGroup) solo.getView(android.R.id.tabs);
View viewYouWantToDoStuffWith = tabs.getChildAt(x); //change x to the index you want.
Now you can perform the click event on tab like below.
solo.clickOnView(viewYouWantToDoStuffWith);