自动化测试工具无法读取PB的sle.text,解决方案

用WinRunner、Rational Rotot等自动化测试工具测试PB程序,会发现无法读取文本框的值,因为PB的控件不是标准的Windows控件。下文给出了一个解决方案


作者:J. Timothy Stewart

 

Apparently, PowerBuilder's StaticText boxes do not follow the MS standards for static text in that they do not update their text captions correctly. If you call a WinAPI GetWindowText funtion with the handle to 
a PB static text box, the API will return the text caption placed in that control at design time. It will NOT ever return the value of that field at runtime if it were to change after development (i.e. status 
bar). This creates a problem for automated testing tools such as SQA TeamTest and QA Partner which rely on the WinAPI to retreive these values from those controls.

 

Our final resolution to this problem is that we used StaticText controls to display the information (instead of SLEs) and we created a global function called F_SETTEXT() which is called whenever the text caption in a static control changes.

 

void function F_SETTEXT( staticbox control, string stext) 
control.text = stext 
SetWindowText(handle(control),sText) 
return

 

This will ensure that other applications can "read" the text in the caption as it uses the WinAPI call to set the text as well as the PB assignment method. This solution works for us.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值