I am developing an application that will programmatically run through a file structure and find all test scripts in that file structure, collecting information about the directory tree, test scripts and associated actions.
Trouble is, a lot of the information needed is trapped in the TSP file of a test script. This file is not very friendly with typical text editors - it only reads well enough for me to know that this is the file that contains all the information about the settings of a test script.
Does anyone know of a way to effectively read the TSP file? I am having the same issue with MTR files.
Can you use the AOM to interrogate the tests settings, something like this:
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Dim qtResultsOpt 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible
' Set QuickTest run options
qtApp.Options.Run.CaptureForTestResults = "OnError"
qtApp.Options.Run.RunMode = "Fast"
qtApp.Options.Run.ViewResults = False
qtApp.Open "C:\Tests\Test1", True ' Open the test in read-only mode
' get test settings info
You could run this for each test, extract the test settings (I'm using MsgBox just as a demo) and write them out to a file or spreadsheet.
I get ya. Now that you've got me thinking, what I may do is use the Settings Object that's native to QTP and design a function that will collect all of the running test's settings and send them to an xml file.
Include the function in every script and then every time a script is run it'll create (replace) a nifty xml file in the test's directory and the xml file will just tag along with the test wherever the test goes.