Micro Focus QTP (UFT) Forums
QTP test run status - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: QTP test run status (/Thread-QTP-test-run-status)



QTP test run status - RamyaSar - 12-28-2011

Hi,

After each test case run I want to set flags correspondingly.Is there any method by which I can know the last test run status.I used Lastrunsttaus and it always shows the status as Running.

Thanks,
Ramya


RE: QTP test run status - sshukla12 - 12-28-2011

Hi,
Is ur requirement is something like a single script driving n number of scripts and u want to store the result of each n number of test cases?
Please elaborate. If yes then I can surely help u and if not, then u must create a .txt file which will include the run status(say this run is nth)in it, when u go for antother run i.e. n+1 then u can refer the .txt file for the run status of previous execution and one more solution u can go for settings.add(key,value) to store the result. Please try this and let me know in case of any query.

Regards,
Sankalp


RE: QTP test run status - ravi.gajul - 12-28-2011

Assuming that you are running multiple scripts say script1, script2, script3 you may try the following code by launching it from a .vbs file.
Code:
testSet = Array( "script1", "script2", "script3" )
Set app = CreateObject("QuickTest.Application")
If Not app .Launched Then  ' If QuickTest is not yet open
   app.Launch ' Start QuickTest (with the correct add-ins loaded)
End If
app.Visible = True ' Make the QuickTest application visible
For i = LBound( testSet ) To UBound( testSet )
   testPath = PathFinder.Locate( testSet( i ) )
   if testPath = "" Then
      Reporter.ReportEvent micFail, "Executing Set", "Test " & testSet( i ) & " not found"
      Exit For
   End If
   app.Open testSet( i ) ' Open the test
   app.Test.Settings.Run.IterationMode = "oneIteration" ' Run only one iteration
   app.Test.Settings.Run.OnError = "Stop"
   Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
   qtResultsOpt.ResultsLocation = "C:\Tests\Results" ' Set the results location
   app.Test.Run qtResultsOpt, True ' Run the test and wait for return
   if StrComp( app.Test.LastRunResults.Status, "Passed" ) <> 0 Then
      Reporter.ReportEvent micFail, testSet( i ), app.Test.LastRunResults.LastError
     End If
Next
Set qtApp = Nothing ' Release the Application object