Environment is global object in UFT, it can be used to store and retrieve both run time and design time data.
Two type of environment variables
1. User defined-it has two types
- internal variable-- referred as default values
-external variable-- referred as constant value
2. Built in-give two type of information
- static data such as OS,OS version,local host name, test name, test fir etc
-Runtime data such as test iteration ,action name,action iteration etc
function for Validate_EnvironmentVar
Public function fnVerifyEnvironmentVar(strTestCaseID,strVarName,strVarValue)
Dim Flag
Set Obj = CreateObject("wscript.shell")
set objEnv = Obj.Environment("System")
sVarValue = objEnv.Item(strVarName)
If Trim(ucase(sVarValue))=Trim(ucase(strVarValue)) Then
Call fnDoneResult("Environment variable verify successfully", strVarName & " variable have value " &strVarValue& " match successfully.")
Flag=True
else
Call fnFailResult("Environment variable verify unsuccessfully",strVarName & " variable have value " &strVarValue& " not match successfully.")
Flag=False
End If
fnVerifyEnvironmentVar=Flag
End function
Two type of environment variables
1. User defined-it has two types
- internal variable-- referred as default values
-external variable-- referred as constant value
2. Built in-give two type of information
- static data such as OS,OS version,local host name, test name, test fir etc
-Runtime data such as test iteration ,action name,action iteration etc
function for Validate_EnvironmentVar
Public function fnVerifyEnvironmentVar(strTestCaseID,strVarName,strVarValue)
Dim Flag
Set Obj = CreateObject("wscript.shell")
set objEnv = Obj.Environment("System")
sVarValue = objEnv.Item(strVarName)
If Trim(ucase(sVarValue))=Trim(ucase(strVarValue)) Then
Call fnDoneResult("Environment variable verify successfully", strVarName & " variable have value " &strVarValue& " match successfully.")
Flag=True
else
Call fnFailResult("Environment variable verify unsuccessfully",strVarName & " variable have value " &strVarValue& " not match successfully.")
Flag=False
End If
fnVerifyEnvironmentVar=Flag
End function
No comments:
Post a Comment