51Testing软件测试论坛

标题: QTP 脚本问题,请大家帮忙看看,谢谢~ [打印本页]

作者: beibeiyier    时间: 2012-3-2 16:12
标题: QTP 脚本问题,请大家帮忙看看,谢谢~
Set f = fso.GetFolder(Environment("TestDir")),不知道这一句是什么意思啊?fso.GetFolder后面不是应该跟一个路径的吗?
作者: beibeiyier    时间: 2012-3-2 16:14
如果大家有关于VBScript的中文教程,麻烦发我一份吧~
邮箱 beibei168169@163.com,谢谢各位了~
作者: lotus    时间: 2012-3-2 16:34
这个QTP调用自己的环境变量,
File->Test Settings中environment项TestDir
Path of the folder in which the test is located

从qtp帮助中复制了详细信息,你参考下吧

Environment Object
Description
Enables you to work with environment variables.

You can set or retrieve the value of environment variables using the Environment object. You can retrieve the value of any environment variable. You can set the value of only user-defined, environment variables.

Syntax
To set the value of a user-defined, environment variable:

Environment (VariableName) = NewValue

To retrieve the value of a loaded environment variable:

CurrValue = Environment (VariableName)


Argument
Type
Description

VariableName  String  The name of the environment variable.  
NewValue  Variant  The new value of the environment variable.  
CurrValue  Variant  The current value of the environment variable.  


Example
The following example creates a new internal user-defined variable named MyVariable with a value of 10, and then retrieves the variable value and stores it in the MyValue variable.

Environment.Value("MyVariable")=10

MyValue=Environment.Value("MyVariable")
作者: lotus    时间: 2012-3-2 16:34
这个QTP调用自己的环境变量,
File->Test Settings中environment项TestDir
Path of the folder in which the test is located

从qtp帮助中复制了详细信息,你参考下吧

Environment Object
Description
Enables you to work with environment variables.

You can set or retrieve the value of environment variables using the Environment object. You can retrieve the value of any environment variable. You can set the value of only user-defined, environment variables.

Syntax
To set the value of a user-defined, environment variable:

Environment (VariableName) = NewValue

To retrieve the value of a loaded environment variable:

CurrValue = Environment (VariableName)


Argument
Type
Description

VariableName  String  The name of the environment variable.  
NewValue  Variant  The new value of the environment variable.  
CurrValue  Variant  The current value of the environment variable.  


Example
The following example creates a new internal user-defined variable named MyVariable with a value of 10, and then retrieves the variable value and stores it in the MyValue variable.

Environment.Value("MyVariable")=10

MyValue=Environment.Value("MyVariable")
作者: beibeiyier    时间: 2012-3-2 16:37
回复 3# lotus


    谢谢啊~讲的很清楚呢~
作者: zk_testing    时间: 2012-3-26 21:59
Environment("TestDir")
调用QTP环境变量。




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2