TestComplete--Variables Object
The Variables object provides a program interface to a collection of project, project suite, network suite or keyword test variables. These can be variables that were defined either in the current project suite (project suite variables), in the current project (project variables), in the NetworkSuite project item of the current project (network suite variables) or in a keyword test (keyword test variables). To get the Variables object for the needed variable collection, use the ProjectSuite.Variables, Project.Variables, NetworkSuite.Variables or KeywordTest.Variables properties correspondingly.
该Variable对象提供了程序的接口,来收集project, project suite,network suite,或keyword test中变量。这些变量时定义在project, project suite,network suite,或keyword test中的。当然,要得到得到变量,需要相应的ProjectSuite.Variables, Project.Variables, NetworkSuite.Variables or KeywordTest.Variables 属性。
Properties
Name Description
VariableByName Returns a variable specified by its name.
返回指定的变量通过它的名字。
VariableCount Returns the total number of variables in the ollection.
返回所有变量的数目。
Methods
Name Description
AddVariable Adds a new variable to the collection.
增加一个变量到变量集
GetVariableCategory Returns the variable category.
返回变量的种类。
GetVariableDefaultValue Returns the default value of a variable.
返回变量的默认值。
GetVariableDescription Returns the variable description.
返回变量的描述。
GetVariableName Returns the name of the variable specified by its
index in the variable collection.
返回变量名通过变量集的索引。
GetVariableType Returns the name of the variable type.
返回变量类型的名字。
RemoveVariable Removes the specified variable from the collection.
从变量集remove掉指定的变量。
VariableExists Checks to see if a variable with the specified
name exists in the given collection.
检查指定的变量是否存在变量集,主要是通过名字。
Note: For each variable that belongs to a particular collection, the Variables object provides a property whose name is the variable name, which must be unique in that collection. Use this property to access the needed variable. A variable name cannot coincide with the name of the object’s methods and properties (that is, you cannot name a variable AddVariable, VariableCount, VariableExists and so on).
The following example modifies an existing variable Var1 defined in the current project.
Project.Variables.Var1 = "New test"
End If
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/Genejiang/archive/2009/11/04/4769568.aspx