Wednesday 30 July 2014

Golden Rules For QTP Starters

                    Hi Friends, I noticed much more comments on the Forums& Other sites, Those are, Why QTP showing error, How to start recording,.......Etc. For that i would like to share some information for freshers. It is not only for freshers, But also for experienced people. Even well known people also some times doing some mistakes. So try to fallow below 6 Rules. To avoid the QTP run time exceptions(errors). 


1) Open QTP with appropriate Add-in
2) Open the SUT manually, Then start QTP Recording
         SUT= Software Under Test
3) You should record on the opened SUT only
4) While recording, Try to avoid Key Board shortcuts
      like Tab, Enter, Backspace....Etc
5) Before starting the test script execution, Make sure application status
        Application status means where we started the recording, That state
6) While executing the script, we should arrange One Appropriate application Only.




For any Doubts Comment Here 

Sunday 27 July 2014

QTP All Files Extensions& How To Associate Those Files In Run Time to Current Test

Hi Friends it is very useful to who want to write QTP Certification test& Along with who are trying jobs on QTP. 

Polineni












We can use below code, To Associate the Function Library In run time to QTP test

'qtpo= QTP Object, to open QTP
'flo=Function Lib, for Add to test
Set qtpo = CreateObject("QuickTest.Application"
 qtpo.Launch
 qtpo.Visible = True
 'Open the test
 qtpo.Open"D:\GUITest2"
 Set flo = objQTP.Test.Settings.Resources.Libraries
  'Associate Function Library if NOT associated already.
 If flo.Find("C:\lib1.vbs") = -1 Then
   flo.Add "C:\lib1.vbs"1
 End

We can Use below code, TO associate the Recovery Scenario in Run-TIme to QTP Test 


'qtpo= QTP Object, to open QTP
'rso=Recovery Scenario object, to add in run time
Set qtpo = CreateObject("QuickTest.Application"
 qtpo.Launch
 qtpo.Visible = True

 Set rso=qtpo.Test.Settings.Recovery
 If rso.count>0 Then
     rso.RemoveAll
 End If
 rso.Add"File path","Scenario name"
  

Saturday 26 July 2014

ToolTip Validation Using QTP

                 Hi friends now a days all of the clients are giving much priority for application Usability, Nothing but usability testing. In the part of usability testing we need to validate Tool Tips of AUT/SUT. Earlier days we did this Tool Tip Validation manually only. But now we can perform that task using automation tools like QTP/UFT.      

               So for that i would like to show different ways


Way 1:=
browser("title:=.*").page("title:=.*").webelement("Xpath:=.*").mouseover
Var=window("nativeclass:=tooltips_class32").GetROProperty("text")
MsgBox Var

Way 2:=
browser("title:=.*").page("title:=.*").webelement("Xpath:=.//*[@id='hplogo']").FireEvent"onmouseover"
Var=window("nativeclass:=tooltips_class32").GetROProperty("text")
MsgBox var

           I think you may know the above syntax to capture Tool Tips. But while executing the test we need to arrange mouse over on the required test object manually, Then only QTP can read the Tool Tip.


Way 3:=          
var =browser("title:=.*").page("title:=.*").webelement("Xpath:=.//*[@id='hplogo']").Object.title
MsgBox Var

The above code also can read the Tool Tips of some test objects some times only. 
       
         But The below code can work on any test object any time, With out any human interception while executing script. 

Way 4:=

 Setting.webpackage("replaytype")=2
browser("title:=.*").page("title:=.*").webelement("Xpath:=.//*[@id='hplogo']").FireEvent"onmouseover"
Var=window("nativeclass:=tooltips_class32").GetROProperty("text")
MsgBox var
Setting.webpackage("replaytype")=1

  

Any Doubts or any issues leave a comment...! 

Thursday 13 March 2014

VBScript For Write& Read in Open Office Calc.

Hi Automation Testers,

Generally most of the companies use Excel as the preferred spreadsheet & most of us are well versed in using Excel through VBScripting & QTP. But then there are few organizations which may prefer to use the open source Open Office Calc for their QTP automation support. I tried to get the know how from the web but could not get it. Tried myself couple of times & developed the below script which is able to read & write into Open Office Calc.

Hope you would benefit from this script...



'smo=service manager object
'od=desktop object
'doo=document object
'so=sheet object
'co=cell object'

Set smo = CreateObject("com.sun.star.ServiceManager")  'To open the Sun Server

Set od= smo.createInstance("com.sun.star.frame.Desktop")  'To open the Desktop 
Set doo = od.loadComponentFromURL("file:///C:\data12.ods", "_blank", 0, array()) 'To open the document
Set so = doo.Sheets.getByName("Sheet4") ' To get the particular sheet   

so.getCellByPosition( 0, 0 ).setString( "Hai" ) 'To Write the String  

so.getCellByPosition( 1, 0 ).setString("Shiva") 
so.getCellByPosition( 2, 0 ).setString("Kumar") 
so.getcellbyposition(3,0).setstring("Polineni")
so.getcellbyposition(0,1).setvalue(90106) 'To Write the Value  so.getcellbyposition(0,2).setstring("Testing")


Note:= Generally in While writing the VBScript for Excel we can write data in sheetobject.cells(row num,column num) But here Sheetobject.getcellbyposotion(column num,row num)

Note2:= And also in Excel row number and Column number starts with 1 onwards, Like sheetobject.cells(1,1)
But In Open Office VBScript Column number and row number starts from 0 onwards like Sheetobject.getcellbyposotion(0,0)