Is there any way to give statuses in QTP?

  • Questions
  • Is there any way to give statuses in QTP?
Question ID: 104948
1
0

I’m trying to figure out a way that I can write my own status messages outside of using the QTP Report object. I don’t need the status information part of the report. I wanted to make notes of what part of the script was being tested and maybe some data that is being used in the test.

Marked as spam
Posted by (Questions: 175, Answers: 22)
Asked on April 5, 2013 4:14 pm
13 views
Answers (1)
4
Private answer

There are a few different things I've used before. One is the FileSystemObject, and the other is the Print command in QTP:

'Create the FileSystemObject
Set FSO = CreateObject(''Scripting.FileSystemObject'')

'Create a text file to write to. If it already exists, overwrite it (True)
Set My_File = FSO.CreateTextFile(''C:'', True)

'Now that the file is created, it is ready for input. Insert the following statement at any point in your script to write to the status file:

My_File.WriteLine ''''

'If you need to write variables or other data to the file, just concatenate it to the string, such as:

My_File.WriteLine ''Testing username: '' & var_userName & '' and ID#: '' & var_ID

'When finished, close the file and destroy the FileSystemObject

My_File.Close
Set My_File = Nothing
Set FSO = Nothing

Another alternative would be to use the obscure Print command in QTP. This will pop open a dialog box (Print Log) that you can use if you want to be able to check status messages that you log as the script is running. It doesn't require creating objects or anything, and is simply a Print command in QTP, followed by a string value that can be any text you want, similar to the WriteLine method above:

Print ''Testing the login functionality''

or

Print ''Using username: '' & var_userName & '' for this iteration''

Marked as spam
Posted by (Questions: 2, Answers: 425)
Answered on April 5, 2013 4:17 pm