Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom function ExitTest
#1
Solved: 10 Years, 9 Months ago
Hi All,

I guess this might not be possible in VB script. But just checking if by anyway we can achieve this. The requirement is that in our framework, at lot of places ExitTest statement was used for invalid cases or inputs. Now the thought is that we should close the application also in all these cases meaning calling ExitTest should first close the application and then exit the test execution. is there anyway QTP provides us this feature to overwrite the functionality of library functions. I guess no, pl share if you have any clue.

Thanks
Sravanthi
Reply
#2
Solved: 10 Years, 9 Months ago
u can use RegisterUserFunc to define the existing QTp functions...

Plz check qtp help for more information.

Regards,
Ankesh
Reply
#3
Solved: 10 Years, 9 Months ago
Hi ,
you can use the below code and call the user defined function CloseApplicationAndTest() instead of ExitTest

Code:
Function CloseApplicationAndTest()
   Dim intcounter
    Set o=Description.Create
    oDesc("micclass").Value="Browser"
    intcounter=0
    While Browser("micclass:=Browser","index:="&intcounter).exist(0) and intcounter<Desktop.ChildObjects(oDesc).count
        If instr(1, Browser("micclass:=Browser","index:="&intcounter).getRoProperty("name"),"Quality Center") = 0 Then
            SystemUtil.CloseProcessByHwnd( Browser("micclass:=Browser","index:="&intcounter).getRoProperty("hwnd"))
        else
            intcounter=intcounter+1
        End if
    wend
    ExitTest
End Function

This will close all the browsers open except quality center

Regards,
Ravi
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP Flex plug-in not identifying custom objects kamalteja 0 2,715 10-19-2012, 09:00 PM
Last Post: kamalteja

Forum Jump:


Users browsing this thread: 1 Guest(s)