做一个开发人员认可的测试人员(二)
作者:网络转载 发布时间:[ 2014/1/23 11:25:01 ] 推荐标签:开发人员 测试人员 自动化测试
这个框架中我个人用的多的函数是Focus方法以及衍生方法,这个方法没有发现有啥跑不过的情况:
'############################################################################
'# Function A_Focus(strCaption as String) as Integer
'# DESCRIPTION:
'# Focus object
'# PARAMETERS:
'# [In] strCaption e.g.,"CPN_DESKTOP"
'# RETURNS:
'# true success
'# false fail
'# ERRORS:
'# (none)
'# EXAMPLES:
'# return = A_Focus("CPN_DESKTOP")
'# Orig Author: XX)
'# Orig Date: May 09, 2005
'# History:
'# May 09, 2005 Original Release
'# Apr 17, 2006 XX If the window state is minimized, then restore the position.
'############################################################################
Function A_Focus(strCaption as String) as Integer
Dim Result as Integer
Result=SQAWaitForObject(";type=window;Caption=" &strCaption, 20000)
If Result<> sqaSuccess Then
A_Focus= false
Exit Function
Else
' If the window state is minimized, then restore it.
Dim state As String
result = SQAGetProperty(";type=window;Caption=" &strCaption, "WindowState", state)
' Valid WindowState:
' 0 : Normal
' 1 : Minimized
' 2 : Maximized
If (state = "1") Then
Window SetContext, "Caption=" &strCaption , ""
Window RestorePos, "", ""
End If
A_Focus= true
Window SetContext, "Caption=" &strCaption , ""
End If
End Function
'############################################################################
'# Function A_WaitWindowAppear(caption As String, Optional Timeout As Variant) As Integer
'# DESCRIPTION:
'# Wait for the object to appear
'# PARAMETERS:
'# [In] caption caption title
'# [In] Timeout time out
'#
'# EXAMPLES:
'# result = A_WaitWindowAppear("Type=CheckBox;WindowIndex=19")
'# Orig Author: XX
'# Orig Date: Apr 05, 2006
'# History:
'# June 08, 2005 Original Release
'############################################################################
Function A_WaitWindowAppear(caption As String,Optional Timeout As Variant) As Integer
If A_WaitForObject(";Type=window;Caption=" & caption,Timeout) = sqaSuccess Then
A_WaitWindowAppear = True
Window SetContext, "Caption=" &caption , ""
Exit Function
Else
A_WaitWindowAppear = false
SQALogMessage sqaWarning, "Caption [" & caption & "] has not appeared" , ""
End If
End Function
'############################################################################
'# Function A_WaitWindowDisappear(recMethod As String, Optional Timeout As Variant) As Integer
'# DESCRIPTION:
'# Wait for the Window to disappear
'#
'# EXAMPLES:
'# result = A_WaitWindowDisappear("Type=CheckBox;WindowIndex=19")
'# Orig Author: XX
'# Orig Date: June 08, 2005
'# History:
'# June 08, 2005 Original Release
'############################################################################
Function A_WaitWindowDisappear(recMethod As String, Optional Timeout As Variant) As Integer
A_WaitWindowDisappear = A_WaitObjectDisappear(";type=window;Caption=" & recMethod, Timeout)
End Function
相关推荐
更新发布
功能测试和接口测试的区别
2023/3/23 14:23:39如何写好测试用例文档
2023/3/22 16:17:39常用的选择回归测试的方式有哪些?
2022/6/14 16:14:27测试流程中需要重点把关几个过程?
2021/10/18 15:37:44性能测试的七种方法
2021/9/17 15:19:29全链路压测优化思路
2021/9/14 15:42:25性能测试流程浅谈
2021/5/28 17:25:47常见的APP性能测试指标
2021/5/8 17:01:11