LoadAndRunAction方法的使用

上一篇 / 下一篇  2010-12-24 00:26:35 / 个人分类:QTP/UFT

脚本运行到该步骤时,调用其他脚本中的action并运行

/J*U%J{&y;e7YD0

可以使用条件语句动态的调用不同的外部action

NWc x*]v0

当运行该步骤时,才会加载该action,而不是当打开测试时,因此

:fr~Bs `.TZ,N0

被调用的action不会在以下地方显示

L]9pY y$|0

Qtpsettingresources

{|-R%yY+FE!W0

Testflow

6Q%a pH7Z0

Missing Resources

'TLL3fuS/CAY!V0

Qc的测试资源模块的附件选项卡(这个有点不解)

Ioh5KH0R!n0
  • 因为是在运行时才加载action,而不是像call to existing action那样会打开一个action。所以在运行过程中对性能会有所影响
  • During a run session, you can view the actions that are run using the LoadAndRunAction statement. As an action begins to run, the action name is displayed in theLoadAndRunActionCalls section of the Action toolbar in the Keyword View and in the Expert View. The called actions remain listed in the toolbar until the end of the run session, at which point they are cleared from the list.
  • At the end of a run session, all of the actions that were dynamically loaded are unloaded. In the Test Results window, you can view the steps that ran during the run session.

语法:51Testing软件测试网?hC%ewH F

LoadAndRunAction(TestPath, ActionName, [Iteration], [Parameters])

"Q Z!]j.\#S{4fby0

TestPath相对路径/绝对路径/QC中的路径

+\[uCM|(s'S0

ActionNameaction的名称51Testing软件测试网#N1G,F Lq+y*w/z

Iteration:循环的设置:oneIteration0(Default)51Testing软件测试网'A$p&Ur9m Ei*A@

allIterations1

W P}u3?Vc|G0

"1-7"51Testing软件测试网q/d"P?2MH~$f0I

Parameters:参数包括输出参数和输入参数51Testing软件测试网[ h2}$t@@7x

 51Testing软件测试网d(w+n(OIO ?6E@){yf

Example

T/P,a*_2C-Rum/fthz2?0

1.使用绝对路径动态调用action51Testing软件测试网-b I!L9V9uc

dim flag,testpath51Testing软件测试网2IO#L4`3Yp

TestPath="c:\QTPTest\"51Testing软件测试网|!BTI3E.EJ

if flag=true then51Testing软件测试网0n0A-o!X;?9j^

LoadAndRunActionTestPath&"OrderActions", "SilverOrder", oneiteration,51Testing软件测试网:~-VAsa

else51Testing软件测试网"CLmL%{J l8_

LoadAndRunAction TestPath&"OrderActions", "NormalOrder", oneiteration,51Testing软件测试网Una*m(MR,Z

end if

5u} I__j0

2.调用QC中的脚本的action

jZa?&un5j0

If QCUtil.IsConnected  Then51Testing软件测试网 oI4c+[}i [-lI

  LoadAndRunAction "[QualityCenter] Subject\testpath ","Action1",oneIteration,51Testing软件测试网E+SmB2nC:K7S@

  End If

6]3V"h t5K0

 

9U3y~1Wj q0
51Testing软件测试网&h4Dok BGWN


TAG:

 

评分:0

我来说两句

Open Toolbar