UFT行动问题

时间:2015-03-12 09:09:58

标签: qtp hp-uft

我正在尝试参数化操作,下面是我设计的代码

Datatable.ImportSheet "Q:\Excel.xls","Sheet1","Action1"
a=datatable.GetSheet("Action1").GetRowCount
For i= 1 to a 
Datatable.GetShee("Action1").SetCurrentRow(i)
If datatable.Value("OracleDatabase","Action1")<>"" Then
    RunAction Datatable.Value("Scriptname","Action1"), oneIteration,"Oracle"
    msgbox  Datatable.Value("Scriptname","Action1")
End If 
If datatable.Value("SQLdatabase","Action1")<>"" Then 
    RunAction Datatable.Value("Scriptname","Action1"), oneIteration 
    msgbox Datatable.Value("Scriptname","Action1") 
End If 
RunAction "Action1 [MediumSanityWF12]", oneIteration 
Next

这里的问题是,当我运行上面的代码时,第一次迭代&#34; Action1 [GUITest1]&#34;正在执行,这是正确的。  在第二次迭代中,对于oracle数据库,&#34; Action1 [GUITest2]&#34;执行脚本并再次执行SQL数据库&#34; Action1 [GUITest1]&#34;被处决了根据我的理解,它应该执行&#34; Action1 [GUITest2]&#34;动作只是因为我使用了数据表的setcurrentrow方法。  我在这里很困惑为什么它正在执行&#34; Action1&#34;用于SQL数据库而不是&#34; Action2&#34;在第二次迭代中?

请说清楚。

1 个答案:

答案 0 :(得分:0)

我希望这应该有用

Datatable.ImportSheet "Q:\Excel.xls","Sheet1","Action1"
a=datatable.GetSheet("Action1").GetRowCount
For i= 1 to a 
Datatable.GetSheet("Action1").SetCurrentRow(i)
If datatable.Value("OracleDatabase","Action1")<>"" Then
    RunAction Datatable.Value("Scriptname","Action1"), oneIteration,"Oracle"

End If 
Datatable.GetSheet("Action1").SetCurrentRow(i)
If datatable.Value("SQLdatabase","Action1")<>"" Then 
    RunAction Datatable.Value("Scriptname","Action1"), oneIteration 

End If 
RunAction "Action1 [MediumSanityWF12]", oneIteration 
Next