Unable to modify the QTP script in QC using Automation Object Model methods ‘GetScript’ and ‘SetScript’
Question ID: 104900
0
0

Unable to modify the QTP script in QC using Automation Object Model. Please find the below code used and let me know where I went wrong.

Code:
—–


Dim qtApp
Set qtApp = createobject("Quicktest.Application")
qtApp.Launch
msgbox "launched"
qtApp.Visible=True
qtApp.TDConnection.Connect "ServerURL", "DomainName", "ProjectName", "UserName", "Password",False
msgbox "connect"
If qtApp.TDConnection.IsConnected Then
    msgbox "connected"
    qtApp.Open "[QualityCenter] Subject\\path to QTP test\\SampleTest",False
    qtApp.Test.CheckOut
Else
    MsgBox "Cannot connect to Quality Center"
End If
context = qtApp.Test.Actions(1).GetScript

context = context&vbNewLine&"'End of Script"

qtApp.Test.Actions(1).SetScript(context)

qtApp.Test.Save


If qtApp.Test.VerCtrlStatus = "CheckedOut" Then
    qtApp.Test.CheckIn
    msgbox "checked In"
End If


qtApp.TDConnection.Disconnect

Set qtApp = Nothing

I didn’t find any change in the script when I had a look at the QTP script in QC after check-in the script modified. Please help me in resolving this issue.

Environment Details:
——————–
QTP 11.0 – 32bit Application, QC 9.2, Microsoft Windows Server 2003 – 64bit OS.

Ran the above script using vbs file from the command prompt "C:\\WINDOWS\\SysWOW64\\cmd.exe" using the command {C:\\WINDOWS\\SysWOW64>cscript.exe "path to vbs file"}.

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on March 16, 2013 12:01 pm
109 views
Answers (1)
0
Private answer

Hi,

take a look at the HP QuickTest Professional Automation Object Model and search for ''Move an Action Call to a New Location within the Parent Action ''. you will find interesting code performing what you need.

This example starts QuickTest, opens a new test, and adds a new action, which calls a second action.
Then it edits the first action's script to move the call to the second action to a new position in the script,validates the syntax of the new script, defines some action parameters, and uploads the modified action script.

regards,
Maximilien

Marked as spam
Posted by (Questions: 0, Answers: 9)
Answered on October 10, 2013 3:23 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top