[code]
'Create a temp file which named testfile.txt (the path as follow scripts)
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("C:\QtpWorkFolder\Path\TempPath\testfile.txt", True)
MyFile.WriteLine("This is a test.")
MyFile.Close
Dim reportPath, testPath
'Get the path of current test's report
reportPath = Reporter.ReportPath
'Show me the report path
MsgBox ("The Test Report Path is: " & reportPath)
'Cut the folder name of the result
testPath = Right(reportPath, 2)
If testPath <= "99" and testPath >= "10" Then
testPath = Left(reportPath, Len(reportPath) - 5)
Else
testPath = Left(reportPath, Len(reportPath) - 4)
End If
'Show me the test path
MsgBox ("The Test Path is: " & testPath)[/code]作者: yabest 时间: 2007-8-30 00:49
hehe, QTP环境变量里有现成的,好像叫TestPath啥的!作者: hsjzfling 时间: 2007-8-30 01:06
直接调用系统环境变量: Environment("TestDir")作者: yuandjing 时间: 2007-8-30 11:54
楼主可以点击“file”->"setting"->"environment"里面列出的build-in的所有的列表就是系统环境变量作者: zhuyuancan 时间: 2007-8-30 14:10
msgbox environment.Value("TestDir")作者: jackymail 时间: 2007-8-30 16:01
楼上的你写的不对。
这个帖子有点搞笑,楼主要分享成就,结果被大家一顿纠正sdlkfj3作者: danmy 时间: 2007-8-30 16:27
呵呵,楼主精神可嘉