1.通过excutefile函数实现
'Use executefile function to load library files. 'Example: executefile "C:\Documents and Settings\tsheth\Desktop\Sample123.vbs" x=50 y=50 result=Sum(x,y) msgbox(result) 'Code in External Library file(.vbs file). Public function Sum(a,b) Dim sum sum=a+b Sum=sum End Function
2.通过自动化接口注入(推荐)
Dim qtpApp Set qtpApp = CreateObject("QuickTest.Application") Dim qtpRepositories Set qtpRepositories = qtApp.Test.Actions("Main").TestLibraries qtpRepositories.Add("C:\ts.vbs")
这种方法很容易就想到, 保存一个配置文件, 然后读取并注入所有的vbs文件