Thursday, September 25, 2008

How the Message Boxes Close Automatically

The following script shows a message box that disappears after the specified timeout (in seconds). The script execution then continues.

If TimeOut is 0, it behaves just like a normal message box. If TimeOut is greater than 0, the dialog box disappears after the specified number of seconds.

Set wShellObj=createobject("WScript.shell")
wShellObj.popup "Hello Uday, How are you",10,"This is sample" ' Displays like this:



The message box automatically closes after 10 sec.s

Even we can handle the error messages from the error handling mechanism like this:
Set fileSysObj=createobject("Scripting.filesystemobject")
On Error resume next
fileSysObj.opentextfile("c:\uday.txt")
str=Err.description
wShellObj.popup str,3,"This is for file not found"

How can I remove test result files from old tests?

You can use the Test Results Deletion Tool to view a list of all the test results in a specific location in your file system or in a Quality Center project. You can then delete any test results that you no longer require.

The Test Results Deletion Tool enables you to sort the test results by name, date, size, and so forth, so that you can easily identify the results you want to delete.

You can find this utility in Start > Programs > QuickTest Professional > Tools > Test Results Deletion Tool.

By using this tool, we can choose the test, for which you want to delete all the result folders.

Here we can select the result folders and delete that folders.

How can I configure the report to show only errors by default?

You can configure the report to show only errors by default by adding the following section to the QTReport.ini file in your \bin folder.

[FilterDialog]

ReportAppDefaultFilter=1 # for error only
ReportAppDefaultFilter=3 # shows all messages (default)

How do I create an action template?

If you want to include one or more statements in every new action in your test, you can create an action template. For example, if you always enter your name as the author of an action, you can add this comment line to your action template. An action template applies only to actions created on your computer.

To create an action template, create a text file containing the comments, function calls, and other statements that you want to include in your action template. The text file must be in the structure and format used in the Expert View.

Save the text file as ActionTemplate.mst in your \dat folder. All new actions you create contain the script lines from the action template.

For Ex:
Here i am adding the following content in the text file.
' You are using QTP 9.0
' The author of the software is Uday

Here it shows how it looks like for every action in the QTP:


Sunday, September 14, 2008

How to use a key combination to send input from keyboard to a application

For Ex: how to send a key combination Alt + F1 key combination to Terminal Emulator?

You can use the below statements:

Dim WshellObjSet
WshellObj=WScript.CreateObject("WScript.Shell")
WshellObj.SendKeys "%+{F1}"

But make sure, whether QTP set context to the application before the these statements.