标题: QTP在webtable中取值,比大小总是错误 [打印本页] 作者: weslywang 时间: 2009-7-23 17:17 标题: QTP在webtable中取值,比大小总是错误 代码如下
for i=2 to y
y=Browser("").Frame("mainFrame_3").WebTable("序号").RowCount
for i=2 to y
val_id =int(Browser("").Frame("mainFrame_3").WebTable("序号").GetCellData(i,1))
id=DataTable("字段值", dtLocalSheet)
state=DataTable("运算符", dtLocalSheet)
'msgbox(val_id)
Select Case true
Case state="等于"
If val_id = id Then
reporter.ReportEvent micPass,"实际结果都等于"& id &"。",val_id
else
reporter.ReportEvent micFail,"实际结果异常,有不等于"& id &"的,实际值为"& val_id &"。",val_id
End If
Case state="大于"
If val_id > id Then
reporter.ReportEvent micPass,"实际结果都大于"& id &"。",val_id
else
reporter.ReportEvent micFail,"实际结果异常,有小于等于"& id &"的,实际值为"& val_id &"。",val_id
End If
Case state="小于"
If val_id < id Then
reporter.ReportEvent micPass,"实际结果小于"& id &"。",val_id
else
reporter.ReportEvent micFail,"实际结果异常,有大于等于"& id &"的,实际值为"& val_id &"。",val_id
End If