Code to copy a test set from one folder to another in Quality Center
I am sharing this info as I had to do quite a research before i found the solution.
Problem: Copy a test set from one folder to another in Quality Center test lab using code.
First things first: This cannot be coded in vbscript or QTP as it uses the ISupportCopyPaste interface and the CopyToClipboard method which is part of this interface. Therefore you cannot declare a statement like Dim iscp As ISupportCopyPaste
A simpler way would be to use vba and do the following:
1. Add the following code in excel vba editor.
2. Add the "OTA COM Type Library" as a reference under tools -> references from excel.
3. Run and enjoy the magic :-)
Solution:
Public Function CopyPasteTestSetFolder(sourceFolderPath, destFolderPath)
strServer = "http://xyz/qcbin"
strDomain = ""
strProject = ""
strUser = ""
strPassword = ""
Set objTDConnection = CreateObject("tdapiole80.TDCONNECTION")
objTDConnection.InitConnection strServer, strDomain
objTDConnection.ConnectProject strProject, strUser, strPassword
Set objTreeManager = objTDConnection.TestSetTreeManager
Set sourceFolder = objTreeManager.NodeByPath(sourceFolderPath)
Set destFolder = objTreeManager.NodeByPath(destFolderPath)
Dim iscp As ISupportCopyPaste
Set iscp = sourceFolder
clipboard = iscp.CopyToClipBoard(sourceFolder.NodeID, 0, sourceFolderPath)
Set iscp = destFolder
iscp.PasteFromClipBoard clipboard, destFolder.NodeID, 0, -1
Set treeMng = Nothing
Set sourceFolder = Nothing
Set destFolder = Nothing
Set iscp = Nothing
End Function
Happy Testing!
hi,
ReplyDeleteLooking for a aladdin.jar file. Please help in providing this jar to work with oracle forms 11g tabbed items
Excellent! Thank you so much for the info!!!
ReplyDeleteGlad that helped!
ReplyDeleteBest Regards,
Ady.
"Quality cannot be sprinkled onto an application right before it gets exposed to your clients"
Technology Specific Guide For QTP - My new Book on QTP
Hi Aditya,
ReplyDeleteThanks for your code. But is there any way that we can achieve this through QTP..?
Regards,
Suman CH
Hi Aditya,
ReplyDeleteOn the same note , can we add scripts from test plan to a Test set under test lab of QC V 10 , using VBA code ?
Regards,
AD
Hi AD,
ReplyDeleteI am sure thats very much possible using OTA, will have to dig a little to see if i have some reusable code.
Let me know if you need help.
Best Regards,
Ady
Is it possible to copy testcases from one server test plan to another lam server test plan?
ReplyDeleteie: archival