简体   繁体   English

弹出对话框后如何获取对话框的实例(如DatePickerDialog,ProgressDialog,TimePickerDialog)

[英]How to get the instance of the dialog (like DatePickerDialog, ProgressDialog, TimePickerDialog) after it pop up

the precondition: I'm working on the android automated test, so we can not touch the source code of app, but just test it. 前提条件:我正在进行android自动测试,因此我们不能触摸应用程序的源代码,而只能对其进行测试。

the question: How to get the instance of the dialog after it pop up? 问题:弹出对话框后如何获取对话框的实例? After we get the instance of it, it will be so convenient for the further operation, like directly set the value of it, instead of send the key event to the activity so many times. 在获得它的实例之后,它将为进一步的操作提供了极大的方便,例如直接设置它的值,而不是将键事件多次发送给活动。

Thanks. 谢谢。

It seems like you're doing "black box testing", which is the domain of such utilities as "Robotium" and "Robolectric". 似乎您正在执行“黑盒测试”,这是诸如“ Robotium”和“ Robolectric”之类的实用程序的领域。 Check them out, they're specifically designed to press buttons, wait for dialogs, accept dialogs and so on. 签出它们,它们专门用于按按钮,等待对话框,接受对话框等。

Dollop , where I work, provides a black box, record-and-play-back tool for Android. 我工作的Dollop提供了一个用于Android的黑匣子,记录和回放工具。 It is not limited to running against a single application at a time. 它不限于一次针对单个应用程序运行。 It's also easy to configure and use, requires no programming, runs against real devices (which do NOT have to be rooted) and automatically saves screenshots as it plays tests. 它也易于配置和使用,无需编程,可在真实设备(不必植根)上运行,并在播放测试时自动保存屏幕截图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM