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.

 

If  Project.Variables.VariableExists( " Var1 " Then
  Project.Variables.Var1 
=   " New test "
End   If

 

 

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/Genejiang/archive/2009/11/04/4769568.aspx

转载于:https://www.cnblogs.com/Tcorner/archive/2009/11/05/1596869.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值