Hi,
I have a testing framework wherein the results from QTP are stored in a Word Doc.
I am running QTP tests from Quality Center. How can I attach this result document to Quality Center?
If you wish to do this manually its straightforward. For automating the task you can use the code below:
LocalFilePath = "C:\Results\Result1.txt" 'Path where your file to be uploaded is located in 'your local hard disk.
Folder_Name = "Subject\Demo\Results" 'Path in Quality Center where you wish to store the
'attachment
Set TDConnection = QCUtil.TDConnection
Set treeManager = TDConnection.TreeManager
Set folder = treeManager.nodebypath(Folder_Name)
set att = folder.attachments
Set atta = att.AddItem(Null)
atta.FileName = LocalFilePath
atta.Type = 1
atta.Post()
Ankur Wrote:If you wish to do this manually its straightforward. For automating the task you can use the code below:
LocalFilePath = "C:\Results\Result1.txt" 'Path where your file to be uploaded is located in 'your local hard disk.
Folder_Name = "Subject\Demo\Results" 'Path in Quality Center where you wish to store the
'attachment
Set TDConnection = QCUtil.TDConnection
Set treeManager = TDConnection.TreeManager
Set folder = treeManager.nodebypath(Folder_Name)
set att = folder.attachments
Set atta = att.AddItem(Null)
atta.FileName = LocalFilePath
atta.Type = 1
atta.Post()
Ankur,
Thanks for your response. I tried the above code but it did not work. I get the error "Node not found" everytime. Below is the code I have used:
LocalFilePath = "C:\TestResult.doc"
Folder_Name = "Subject\Automation\Automation"
Set TDConnection = QCUtil.TDConnection
Set treeManager = TDConnection.TreeManager
Set folder = treeManager.nodebypath(Folder_Name)
Set att = folder.attachments
Set atta = att.AddItem(Null)
atta.FileName = LocalFilePath
atta.Type = 1
atta.Post()
Here's what I want to do. I want to attach the 'C:\TestResult.doc' to the test case placed in the 'Test Lab' in Quality Center under the path "Root\Automation\Automation". The name of the test case is "Test Case 01"
Now i tried various permutations and combinations for nodebypath----
"Subject\Automation\Automation"
"Root\Automation\Automation"
"Subject\Automation\Automation\Test Case 01"
"Root\Automation\Automation\Test Case 01"
"[Quality Center]Subject\Automation\Automation\Test Case 01"
"[Quality Center]Root\Automation\Automation\Test Case 01"
I tried to debug this issue using value from nodebyID (in a messagebox) instead of nodebypath and I found that 'Set folder = treeManager.nodebyID(1)' returns a field from Defects Tab of QC.
Hi,
I am trying to attach test result to Test Lab in Quality center but its giving me error of "Root" node not found.
Code for same:
strFilePath="C:\Test.xls"
Folder_Name="Root\Project123\Test Result"
Set TDConnection = QCUtil.TDConnection
Set treeManager = TDConnection.TreeManager
Set root = treeManager.TreeRoot("Root") ' saving in test lab module
Set folder1 = root.FindChildNode("Test Result") ' saving in test lab module
Set fact = folder1.Attachments
Set atta=fact.AddItem(Null)
atta.FileName = strFilePath
atta.Type = 1
atta.Post()
Please let me know!!
Thanks in advance.
Praj
vikas_dhir Wrote:Ankur Wrote:If you wish to do this manually its straightforward. For automating the task you can use the code below:
LocalFilePath = "C:\Results\Result1.txt" 'Path where your file to be uploaded is located in 'your local hard disk.
Folder_Name = "Subject\Demo\Results" 'Path in Quality Center where you wish to store the
'attachment
Set TDConnection = QCUtil.TDConnection
Set treeManager = TDConnection.TreeManager
Set folder = treeManager.nodebypath(Folder_Name)
set att = folder.attachments
Set atta = att.AddItem(Null)
atta.FileName = LocalFilePath
atta.Type = 1
atta.Post()
Ankur,
Thanks for your response. I tried the above code but it did not work. I get the error "Node not found" everytime. Below is the code I have used:
LocalFilePath = "C:\TestResult.doc"
Folder_Name = "Subject\Automation\Automation"
Set TDConnection = QCUtil.TDConnection
Set treeManager = TDConnection.TreeManager
Set folder = treeManager.nodebypath(Folder_Name)
Set att = folder.attachments
Set atta = att.AddItem(Null)
atta.FileName = LocalFilePath
atta.Type = 1
atta.Post()
Here's what I want to do. I want to attach the 'C:\TestResult.doc' to the test case placed in the 'Test Lab' in Quality Center under the path "Root\Automation\Automation". The name of the test case is "Test Case 01"
Now i tried various permutations and combinations for nodebypath----
"Subject\Automation\Automation"
"Root\Automation\Automation"
"Subject\Automation\Automation\Test Case 01"
"Root\Automation\Automation\Test Case 01"
"[Quality Center]Subject\Automation\Automation\Test Case 01"
"[Quality Center]Root\Automation\Automation\Test Case 01"
I tried to debug this issue using value from nodebyID (in a messagebox) instead of nodebypath and I found that 'Set folder = treeManager.nodebyID(1)' returns a field from Defects Tab of QC.
(01-13-2008 12:19 PM)Ankur Wrote: [ -> ]If you wish to do this manually its straightforward. For automating the task you can use the code below:
LocalFilePath = "C:\Results\Result1.txt" 'Path where your file to be uploaded is located in 'your local hard disk.
Folder_Name = "Subject\Demo\Results" 'Path in Quality Center where you wish to store the
'attachment
Set TDConnection = QCUtil.TDConnection
Set treeManager = TDConnection.TreeManager
Set folder = treeManager.nodebypath(Folder_Name)
set att = folder.attachments
Set atta = att.AddItem(Null)
atta.FileName = LocalFilePath
atta.Type = 1
atta.Post()
Hi Ankur,
Can u please elaborate this code for
downloading the scripts path files from excel(batch testing) to qtp and after running in qtp, the results should be uploaded to QC