Monday, October 3, 2011

Creating a new column in a runtime datatable and adding values and moving the these values to the new column

Datatable.AddSheet("sample").AddParameter "OldColumn","pavan"
For i= 1 to 10
datatable.SetCurrentRow(i)
datatable.Value("OldColumn","sample") = "pavan"&(i)Next
rw_cnt = datatable.GetSheet("sample").GetRowCount
msgbox rw_cnt
datatable.GetSheet("sample").AddParameter "newcoloumn","Row1Value"
For k = 1 to rw_cnt
datatable.SetCurrentRow(k)
old_val = datatable.Value("OldColumn","sample")
datatable.Value("newcoloumn","sample") = old_val
Next
datatable.GetSheet("sample").DeleteParameter("OldColumn")


-- Pavankumar Nandagiri

How to add multiple values to a column for a runtime data table

'Adding a new sheet @ runtime
Datatable.AddSheet("dtGlobalSheet").AddParameter "OldColumn","pavan"
'Adding multiple values
For i= 1 to 10
datatable.SetCurrentRow(i)
datatable.Value("OldColumn","dtGlobalSheet") = "pavan"&(i)
Next

Thanks,
Pavankumar Nandagiri

Tuesday, January 6, 2009

Script for connecting to TD QC using AOM and open a script "qtp_demo"

Dim qt_obj 'Define a Quick Test object
qt_obj = CreateObject("Quick Test.Application") ' Instantiate a QT Object. It does not start QTP.
qt_obj.launch ' Launch QT
qt_obj.visible ' Make QT visible
qt_obj.TDConnection.Connect "http://tdserver/tdbin", _ 'Referencing TDConnection Object
"TEST_DOMAIN", "TEST_Project", "Ankur", "Testing", False ' Connect to Quality Center
If qt_obj.TDConnection.IsConnected Then ' If connection is successful
qt_obj.Open "[QualityCenter] Subject\tests\qtp_demo", False ' Open the test
Else
MsgBox "Cannot connect to Quality Center" ' If connection is not successful, display an error message.
End If
To quickly generate an AOM script with the current QTP settings. Use the Properties tab of the Test Settings dialog box (File > Settings) OR the General tab of the Options dialog box (Tools > Options) OR the Object Identification dialog box (Tools > Object Identification). Each contain a "Generate Script" button. Clicking this button generates a automation script file (.vbs) containing the current settings from the corresponding dialog box.
You can run the generated script as is to open QuickTest with the exact configuration of the QuickTest application that generated the script, or you can copy and paste selected lines from the generated files into your own automation script.

Wednesday, December 31, 2008

Working with AOM

Dim qtApp, qtRepositories, lngPosition


'Open QuickTest and create the Application object

Set qtApp = CreateObject("QuickTest.Application")
qtApp.Launch
qtApp.Visible = True


'Open a test and get the "Login" action's object repositories collection

qtApp.Open "D:\Fatima\trial-qtp\adv topics\Test1", False, False
Set qtRepositories = qtApp.Test.Actions("Login").ObjectRepositories

' Add shared_rep.tsr if it's not already in the collection
If qtRepositories.Find("D:\Fatima\trial-qtp\adv topics\shared_rep.tsr") = -1 Then ' If the repository cannot be found
qtRepositories.Add "D:\Fatima\trial-qtp\adv topics\shared_rep.tsr", 1
End If

' If additional_rep.tsr is moved down the list - place it back at position 1
If qtRepositories.Count > 1 And qtRepositories.Item(1) = "D:\Fatima\trial-qtp\adv topics\additional_rep.tsr" Then
qtRepositories.MoveToPos 1,2
End If

' If debug.tsr is in the collection - remove it
lngPosition = qtRepositories.Find("D:\Fatima\trial-qtp\adv topics\debug.tsr")
If lngPosition <> -1 Then
qtRepositories.Remove lngPosition
End If

' Set the new object repository configuration as the default for all new actions
qtRepositories.SetAsDefault


qtApp.Test.Save
qtApp.Quit

Set qtRepositories = Nothing
Set qtApp = Nothing

Thursday, December 18, 2008

how to return a value from a function

Function func1(a,b)

sum = a+b
func1 = sum
End Function


aaa= func1(2,3)
msgbox aaa


Regards,

Pavankumar Nandagiri............

Google Search

Google