|
我想知道QTP里面有没有更方便,更简短的获得当前运行的test的路径的方法。
这是我自己写的,貌似偏长偏繁了点。
不知道谁有更便捷的没?
[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] |
|