Tuesday, June 3, 2008

Library Files

Library files are containing normal VB Script code.
We can load library files by using 2 ways -

1. Choose Test-Settings-Resources tab-Click on + button - browse and select library file-click OK
2. Use Executefile function to load library files at run time.

When we associate a library file with the test, then all functions with in the library are available to the actions presents in the test.
But when we use executefile function to load a library file, then the functions with in the library file are restricted to a specific action.


Ex: ExecuteFile "FilePath"

Sample Script:

execute file "C:\sample.vbs"
x=10
y=5
result=SumofTwoNumbers(x,y)
msgbox (result)

Code in Sample.vbs -

Public Function SumOfTwoNumbers(a,b)
Dim sum
sum=a+b
SumOfTwoNumbers=sum
End Function

No comments:

Post a Comment