Private Function CopyPasteTest(sourceFolderPath, destFolderPath, TestName) As Test ' Copy a test, including design steps and parameters ' For example: ' CopyPasteTest "Subject\TestFolder1", "Subject\TestFolder2", "Test1" ' Copies Test1 to TestFolder2 Dim sourceFolder As SubjectNode Dim destFolder As SubjectNode Dim treeMng As TreeManager Dim testF As TestFactory Dim iscp As ISupportCopyPaste Dim clipboard As String Dim aFilter As TDFilter Dim TestsList As List Dim Test As Test On Error GoTo FUNC_ERR Set CopyPasteTest = Nothing Set treeMng = tdc.TreeManager Set sourceFolder = treeMng.NodeByPath(sourceFolderPath) Set testF = sourceFolder.TestFactory ' Find the test ID. Set aFilter = testF.Filter TestName = """" & TestName & """" aFilter.Filter("TS_NAME") = TestName Set TestsList = aFilter.NewList() Set Test = TestsList.Item(1) ' Copy the source test. Set iscp = testF clipboard = iscp.CopyToClipBoard(Test.ID, 0, "") ' Paste the test in the destination folder. Set destFolder = treeMng.NodeByPath(destFolderPath) Set testF = destFolder.TestFactory Set iscp = testF iscp.PasteFromClipBoard clipboard, _ destFolder.NodeID, _ COPY_PASTE_NO_LINKED_TEST_MODE, _ 1 destFolder.Refresh 'Get the new test and return it Dim tFilter As TDFilter, tList As List Set tFilter = testF.Filter tFilter.Filter("TS_NAME") = TestName Set tList = tFilter.NewList Set CopyPasteTest = tList(1) Exit Function FUNC_ERR: Set CopyPasteTest = Nothing End Function