如何自动化黑莓 J2ME 应用程序的击键?
我正在尝试对使用 MIDlet 架构上的 J2ME 编写的黑莓应用程序进行自动化测试。
我有一个应用程序已经在黑莓设备上运行。我正在现有的应用程序上编写我的 TestApp(再次用 J2ME 编写)。 (即,我的 TestApp 扩展到已经是原始应用程序并且它运行 - 继承)。
我试图通过我的 TestApp 运行 OriginalApp 并使用我的 TestApp 自动处理控件。尽管我已经获得了黑莓设备的按键代码,但我无法自动执行按键操作。
我使用的键码就像
KEY_BB_FIRE = -1204;
KEY_BB_UP = -1200;
KEY_BB_DOWN = -1201;
KEY_BB_LEFT = -1202;
KEY_BB_RIGHT = -1203;
我尝试使用 Screen 类的 _keyPressed 和 _keyReleased 方法。
boolean sendKeys(Form obj, int keyObj){
try{
obj._keyPressed(keyObj);
obj._keyReleased(keyObj);
}
catch (Exception e){
System.out.println("ERROR: Striking key in Form failed: "+keyObj);
return false;
}
return true;
}
同样,我已经获得了诺基亚设备的关键代码,并且我已经完成了诺基亚相同应用程序的自动化。只是在黑莓上使用相同的技术时遇到了麻烦。
I am trying to do automation testing over a blackberry application written using J2ME over MIDlet architecture.
I have an application already running on blackberry devices. I am writing my TestApp (written again in J2ME) over existing App. (i.e., my TestApp extends to already Original App and it runs - inheriting).
I am trying to run the OriginalApp through my TestApp and handle the controls automatically using my TestApp. I am not able to automate the key strokes although I have already got the key codes of the blackberry device.
Keycodes I am using are like
KEY_BB_FIRE = -1204;
KEY_BB_UP = -1200;
KEY_BB_DOWN = -1201;
KEY_BB_LEFT = -1202;
KEY_BB_RIGHT = -1203;
I am trying to use _keyPressed and _keyReleased methods of Screen class.
boolean sendKeys(Form obj, int keyObj){
try{
obj._keyPressed(keyObj);
obj._keyReleased(keyObj);
}
catch (Exception e){
System.out.println("ERROR: Striking key in Form failed: "+keyObj);
return false;
}
return true;
}
Similarly I have got the key codes for Nokia device and I have completed automating the same application for Nokia. Just having trouble using the same technique on a blackberry.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论