The requirement is that I can issue a single command ( or have a
scheduler do it) and walk away. When I come back, I want to see if all
the tests passed or if any failed (thumbs up/thumbs down).
I've seen mention of a unsupported tool from the QTP folks that does
this but I've not been able to find it (One chap I found who had it
doesn't have it any more.)
I'd appreaciate any help or pointers you might have.
cscript //nologo .\test.vbs >> test_results.txt 2>&1
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible
qtApp.Open "D:\Program Files\Mercury Interactive\QuickTest Professional\Tests\AllenCarr\aldebaran_ru", True ' Open the test in read-only mode
' set run settings for the test
Set qtTest = qtApp.Test
qtTest.Run
WScript.StdOut.Write "Test status: " + qtTest.LastRunResults.Status + vbCr ' Check the results of the test run
qtTest.Close ' Close the test
qtApp.Quit ' Close the QTP'
And, last note... "D:\Program Files\Mercury Interactive\QuickTest Professional\Tests\AllenCarr\aldebaran_ru" is my script which sends special messages to site.
That's all.
So, what I have is the following... Every 3 days scheduler executes this script. Result of test execution is written to file ("test_results.txt" in this case).
Pay attention, I use file logging for results (
WScript.StdOut.Write "Test status: " + qtTest.LastRunResults.Status + vbCr). But you can send messages via Win-messenger service or send emails (I can provide such scripts for additional reward :) ).
Is there a way to also pass input parameters to the test and read the
output parameters?
-----
M.
> --
Try to use Quality Center (former TestDirector).
It has a cool scheduler for QTP.
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim pDefColl 'As
QuickTest.ParameterDefinitions ' Declare a Parameter Definitions collection
Dim pDef ' As
QuickTest.ParameterDefinition ' Declare a ParameterDefinition object
Dim rtParams 'As
QuickTest.Parameters ' Declare a Parameters collection
Dim rtParam '
As QuickTest.Parameter ' Declare a Parameter object
'Dim cnt, Indx As Integer
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible
qtApp.Open "D:\Tests\MyTest"
' Retrieve the parameters collection defined
for the test.
Set pDefColl =
qtApp.Test.ParameterDefinitions
cnt = pDefColl.Count
Indx = 1
' Display the names and values of each of the
parameters in the collection.
While Indx <= cnt
Set pDef =
pDefColl.Item(Indx)
MsgBox "Param name:
" & pDef.Name & "; Type:
" & pDef.Type & "; InOut: " & pDef.InOut & "; Description: " _
& pDef.Description
& "Default value: " &
pDef.DefaultValue
Indx = Indx + 1
Wend
Set rtParams = pDefColl.GetParameters() ' Retrieve the Parameters collection defined for the test.
Set rtParam = rtParams.Item("InParam1") '
Retrieve a specific parameter.
rtParam.Value = "Hello" ' Change the parameter value.
qtApp.Test.Run , True, rtParams ' Run the test with changed parameters.
MsgBox rtParams.Item("OutParam1").Value
' Display the value of an output parameter after the
test runs.
Thank you very much for your detailed answer. I was looking for the
second way to do it - scripting - and your sample gave me exactly what
I needed.
For others who are interested in running tests from external scripts,
take a look at the QuikTest Automation Reference documentation that
comes with QTP installation. I just discovered it.
-----
M.
> > > On 11/2/06, Dmitry Motevich <manga...@gmail.com> wrote:
>
> > > > I need to run QTP tests without a human in the loop - that is
> > > > automatically and unattended. If QTP needs to be driven by an
> > external
> > > > script (shell, Perl, Windows's CScript,...) that's fine.
>
> > > > The requirement is that I can issue a single command ( or have a
> > > > scheduler do it) and walk away. When I come back, I want to see if
> > all
> > > > the tests passed or if any failed (thumbs up/thumbs down).
>
> > > > I've seen mention of a unsupported tool from the QTP folks that does
> > > > this but I've not been able to find it (One chap I found who had it
> > > > doesn't have it any more.)
>
> > > > I'd appreaciate any help or pointers you might have.
>
> > > --
>
> parameters.jpg
> 33KViewDownload
--
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
---
You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mercuryqtp+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.