Facebook

For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
New Schedule in MindQ Systems, Madhapur By SUDHAKAR
Course Name Date Time Duration Type Branch
Selenium+Appium 16th October 2017 7.30 AM - 9.00 AM IST 45 Days ClassRoom + Online Mind Q Madhapur
Selenium+Appium 30th October 2017 9.30 AM - 11.00 AM IST 45 Days ClassRoom + Online Mind Q Madhapur

A book "Cracking the QTP interview" authored by Sudhakar.Read More. Buy From FlipKart

Monday, January 23, 2012

Pause, Continue & Stop QTP Execution using Windows Shortcut Keys

When QTP is running a script, it is very difficult to Pause or Stop the execution as QTP always highlights the Application. But to Pause or Stop QTP Execution we must click on those buttons in QTP.
But this process is very easy if we create an Automation Object Model Script and enable some windows shortcut keys. Below is the step by step process

1.       Prepare AOM scripts for Pause, Continue & Stop QTP execution

'Pause.vbs
'**************************************************
'Pause QTP Execution
Dim qtApp
Set qtApp = CreateObject("QuickTest.Application")
qtApp.Test.Pause
Set qtApp =Nothing
'**************************************************

'Continue.vbs
'**************************************************
'Continue QTP Execution
Dim qtApp
Set qtApp = CreateObject("QuickTest.Application")
qtApp.Test.Continue
Set qtApp =Nothing
'**************************************************

'Stop.vbs
'**************************************************
'Stop QTP Execution
Dim qtApp
Set qtApp = CreateObject("QuickTest.Application")
qtApp.Test.Stop
Set qtApp =Nothing
'**************************************************

2.       Save each Script in to different VBS files (Pause.vbs, Continue.vbs, Stop.vbs)
3.       Copy all VBS files in to a folder
4.    Create shortcuts for all files in the same folder (Right click on each file -> Create Shortcut)
a.       Now there should be 6 files in that folder. 3 original files and 3 shortcut files
5.       Go to File properties for “Shortcut to Pause.vbs” (Right Click on file -> Properties)
6.       There should be 3 Tabs General, Shortcuts & Security
7.       Go to Shortcut tab -> Shortcut Key
8.       Click on the text box beside Shortcut Key
9.       Now press Ctrl+Alt+P. Click on OK.
10.   Repeat 5-9 steps for Shortcut to Continue.vbs and Shortcut to Stop.vbs files
11.   Give Ctrl+Alt+S for Stop, Ctrl+Alt+R  for Continue

The shortcut key setup is done for to Pause, Continue and Stop QTP executions. Now verify whether these shortcut keys are working or not. Follow below steps to verify

1.       Open QTP
2.       Copy and paste below code on Expert view

Fori=1to500
    wait(1)
Next

3.       Start Execution
4.       In middle of execution Press Ctrl+Alt+P
5.       Verify that QTP Pause the Execution
6.       Press Ctrl+Alt+R
7.       Verify that QTP continuing the execution
8.       Press Ctrl+Alt+S
9.   Verify that QTP Stops the execution

Note:
The shortcut keys will not work if those are already assigned to a different application. In such cases just changes the shortcut key combination.

_______________________________________
Please send your Suggestions and Doubts to my yahoo group http://in.groups.yahoo.com/group/qtpsudhakar

3 comments :

  1. Thanks Sudhakar. But the shortcut didnt work for me. Do I have to save the files in some particular location? I am saving it in "My documents". I am connecting to QC and running scripts on QTP.
    Please advise

    ReplyDelete
  2. Hi i have tried this.... But how do i link the 3 vbs files to the script am running....
    I have followed the same procedure mentioned above and i have run the
    For i=1 to 500
        wait(1)
    Next
    when i have Ctrl+Alt+S for Stop it's not working. Applies the same with others.
    Could you please suggest if am going wrong anywhere and why is this not working....

    Regards,
    Usha.

    ReplyDelete
  3. I suppose you have to add the folder that contains the three vbs files to folder list where QTP suppose to find files (OR, Function ....)

    You have to go to the menu Tools>Folder and add the folder containing the three vbs files.

    ReplyDelete