Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP Automate
#1
Solved: 11 Years, 4 Months ago
Hi All

I want completely automate the QTP test , that means i want to start the QTP automatically and load(Open) the test file and run the test. I can write a .bat file to open the tool but i was stuck when i try to open my test file. Do you have any idea about like this matter ??

Can QTP handled command lines ? (By windows commands)

Thanks
Reply
#2
Solved: 11 Years, 4 Months ago
hi eroshan,
it would be always better if you can paste exactly, where are you stuck , a piece of code in you bat file can give the better idea.
although you can do this using vbscript.
copy the code below and save as .vbs file, you can execute this vbs file from command prompt.
Code:
Dim qtpApp    
Dim qtpTest      
Set qtpApp = CreateObject("QuickTest.Application")      
qtpApp.Open TestPath, True  
Set qtpTest = qtpApp.Test  
qtpTest.Run

search this forum for more help on this.

Reply
#3
Solved: 11 Years, 4 Months ago
[quote='Saket' pid='7359' dateline='1252473659']
hi eroshan,
it would be always better if you can paste exactly, where are you stuck , a piece of code in you bat file can give the better idea.
although you can do this using vbscript.
copy the code below and save as .vbs file, you can execute this vbs file from command prompt.
Code:
Dim qtpApp    
Dim qtpTest      
Set qtpApp = CreateObject("QuickTest.Application")      
qtpApp.Open TestPath, True  
Set qtpTest = qtpApp.Test  
qtpTest.Run

I am very new for vbs Can you explain above code.
where should i place my test file name
where should i place path of the test file

Thanks
Reply
#4
Solved: 11 Years, 4 Months ago
Sorry, my mistake I should mention this in my reply
replace TestPath with your Test file path.
Use this modified code
Code:
Dim qtpApp    
Dim qtpTest      
Set qtpApp = CreateObject("QuickTest.Application")
qtApp.Visible = true    
qtpApp.Open <<Your Test Path>>, True  
Set qtpTest = qtpApp.Test  
qtpTest.Run

Set qtTest = Nothing
Set qtApp = Nothing

Reply
#5
Solved: 11 Years, 4 Months ago
[quote='Saket' pid='7362' dateline='1252475940']

Hi Saket


Sorry its not working , it gives this error

Line : 4
Char : 1
Object required : 'qtApp'
Code : 800A01A8
Source : Microsoft VBScript error


This is my code
Code:
Dim qtpApp    
     Dim qtpTest      
     Set qtpApp = CreateObject("QuickTest.Application")
     qtApp.Visible = true    
     qtpApp.Open "C:\QA Tools\eroshan\Test1", True  
     Set qtpTest = qtpApp.Test  
     qtpTest.Run

      Set qtTest = Nothing
      Set qtApp = Nothing

do you have any idea ?
can you tell me what is this "QuickTest.Application" for?

Thanks
Reply
#6
Solved: 11 Years, 4 Months ago
replace 'qtApp.Visible = true' with 'qtpApp.Visible = true'

look into 'QuickTest Professional Automation Object Model Reference' in QTP Help for detailed info on this.
refer [http://mercuryquicktestprofessional.blog...tml]Basics of AOM[/url]

Reply
#7
Solved: 11 Years, 4 Months ago
[quote='Saket' pid='7364' dateline='1252480395']

Hi Saket

it works , thank you very much Saket.
Reply
#8
Solved: 11 Years, 4 Months ago
[quote='eroshan' pid='7365' dateline='1252481459']
[quote='Saket' pid='7364' dateline='1252480395']

Hi Saket

There is a small question about vbs. i want to close the QTP tool window after run the the test. What is the line should i add to the script??

This is the script =>
Code:
Dim qtpApp
                                   Dim qtpTest
                                     Set qtpApp = CreateObject("QuickTest.Application")
                                     qtpApp.Visible = true
                                     qtpApp.Open "C:\QA Tools\eroshan\Test1", True
                                     Set qtpTest = qtpApp.Test
                                     qtpTest.Run

                                    Set qtTest = Nothing
                                    Set qtApp = Nothing

Thanks
Reply
#9
Solved: 11 Years, 4 Months ago
Add below code after qtpTest.Run statement
Code:
qtpTest.Close
qtpApp.quit

Set qtpTest = Nothing
Set qtpApp = Nothing

eroshan - always wrap your code with proper tags to make the post mmore readable. Refer Forum Help.

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  "How to automate SAP Applications using QTP" suresz449 9 23,159 09-01-2017, 12:42 PM
Last Post: Shiva Kumar
  Automate BMC Control M applications using QTP Saranyaciet2 0 2,828 05-22-2015, 09:43 AM
Last Post: Saranyaciet2
  Can we automate Forte UDS applications using QTP? premanand1979 0 2,235 09-18-2014, 01:58 AM
Last Post: premanand1979
  How to automate IVR(interactive voice response) using QTP akhandesh 0 3,364 06-26-2014, 12:36 PM
Last Post: akhandesh
  Want to automate qc using qtp venkatkoritala 1 2,945 03-26-2014, 08:32 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)