Programmatically attach file to test run (QTP)

Tuesday, March 25, 2014
Avatar
Does anyone have example of code for attaching a file to the current test run?  I would like to include an attachment to an automated QTP test each time it executes from remotelaunch.
4 Replies
Monday, March 31, 2014
Avatar
inflectra.jimx
re: mehlerr Tuesday, March 25, 2014
Hi Robert

Most likely you'd need us to give you the source code to the QTP plugin, that would be the easiest way. If you send a request to support@inflectra.com or log a help desk ticket on our website, we can provide it for you.

Regards

Jim
Thursday, April 3, 2014
Avatar
re: inflectra.jimx Monday, March 31, 2014

I can include code below in a QTP test to check for a Quality Center connection and attach a file to the current executed run.  Generally I write to a log during a test run and upload to Quality Center at the end of the run.  I may want to use similar code to attach a screenshot or other data that is otherwise lost.  Is there similar code I can use in a QTP script to attach data to the test run in SpiraTeam?

var_connection = QCUtil.IsConnected
If var_connection = True Then
 If QCUtil.CurrentTestSetTest is Nothing then
  Exit Function
 Else 
  Set CurrentRunObj = QCUtil.CurrentRun.Attachments
  Set AttcObj = CurrentRunObj.AddItem(Null)
  AttcObj.FileName = Log_File
  AttcObj.Type = 1
  AttcObj.Post
  AttcObj.Refresh
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set ResultFile = fso.GetFile(Log_File)
  ResultFile.Delete
 End If 
End If

Wednesday, February 28, 2018
Avatar
re: mehlerr Thursday, April 3, 2014

Does anybody know how to fix the following problem with UFT 12.54 and ALM 12.50?

QCUtil.CurrentTestSetTest is Nothing

AND

QCUtil.CurrentRun.Attachments ----------------------------------> Err.Number = 424

'############################################################

Probably it needs to install an additional patch or addin

 

Tuesday, June 1, 2021
Avatar
re: mehlerr Tuesday, March 25, 2014

HI,

YES, you can use anything that can "do" COM, and that includes C#. Also VB.NET of course.

and Perl, Python, Javascript, and others.

With no help from google, you will have to follow your nose, on how to deal with the interface, but it's not that difficult when you have the existing example. Also your vendor, ideally, will have documented the COM interface for you.

Visit:

Software Testing training 

Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885

 

Statistics
  • Started: Tuesday, March 25, 2014
  • Last Reply: Monday, December 13, 2021
  • Replies: 4
  • Views: 12273