aazimurj
11 years agoOccasional Contributor
WScript.Arguments equivalent in testComplete vbscript
Hi,
I am trying to write few restore scripts for my tests. I am using VBscript language for my scripts in TestComplete.
Because it is a restore script , I was trying to add some error checks for
I would like my function to be something similar to
Function mytest(args1,args2)
for each x in WScript.Arguments
if (IsNull(x)) then
log.error("Argument: " + x + "is NULL")
Runner.Stop
end if
Next
end Function
Wscript is the root object of windows scripting host and I think it cannot be directly used in testcomplete without initialization.
Whenever I run my script i get following error in TestComplete
Microsoft VBScript runtime error
Object required: 'WScript'
Is there any such object in TestComplete's vbscript environment which holds all arguments passed onto procedures?
for workaround what I cheated by creating an array of arguments in function itself like below
Function mytest(args1,args2)
argList=Array(args1,args2)
for each x in argList
if (IsNull(x)) then
log.error("Argument: " + x + "is NULL")
Runner.Stop
end if
Next
end Function
This works ok for me but was wondering if there is any default object which I can use
I am trying to write few restore scripts for my tests. I am using VBscript language for my scripts in TestComplete.
Because it is a restore script , I was trying to add some error checks for
arguments passed are unset (for example "")
arguments passed are NULL
I would like my function to be something similar to
Function mytest(args1,args2)
for each x in WScript.Arguments
if (IsNull(x)) then
log.error("Argument: " + x + "is NULL")
Runner.Stop
end if
Next
end Function
Wscript is the root object of windows scripting host and I think it cannot be directly used in testcomplete without initialization.
Whenever I run my script i get following error in TestComplete
Microsoft VBScript runtime error
Object required: 'WScript'
Is there any such object in TestComplete's vbscript environment which holds all arguments passed onto procedures?
for workaround what I cheated by creating an array of arguments in function itself like below
Function mytest(args1,args2)
argList=Array(args1,args2)
for each x in argList
if (IsNull(x)) then
log.error("Argument: " + x + "is NULL")
Runner.Stop
end if
Next
end Function
This works ok for me but was wondering if there is any default object which I can use