很多网友都问道,在QTP里面,在2个Action之间怎么通过Parameter传递参数。
Action之间传递参数有3种方式
1、 环境变量
这个简单,在设置中自定义环境变量就行了,定义完了,如果想留着下次使用,还可以导出。
2、DataTable
3、Parameter
举个例子就明白了
a 在默认Action1加入代码:
print "This is Action1"
Parameter("name") = "from action1" '记住这个地方,给name赋值一定要用Parameter包起来,
'不然系统不知道你给InputParameter里的name赋值
RunAction "Action2", oneIteration,Parameter("name")
同时,添加一个InputParameter : name
b test 中添加Action2 (After the current step), 并加入代码:
print "In the action2 : "¶meter("name")
同时,添加一个InputParameter : name
最后,运行结果如下图:
687

被折叠的 条评论
为什么被折叠?



