static void Main(string[] args) { using (TCAPI tcapi = TCAPI.CreateInstance()) { TCWorkspace workspace = tcapi.OpenWorkspace( twsPath: @"C:\Users\estan\Desktop\trainings\TOSCA Customizations\Tosca Workspace\Training Customizations\Training Customizations.tws", loginName: "Admin", loginPassword: ""); TCProject project = workspace.GetProject(); TCFolder folder = project.CreateComponentFolder(); folder.Name = "Created folder With Script"; folder.EnsureUniqueName(); // workspace.Save(); List <TCObject> search_result = project.Search(tqlString: "=>SUBPARTS:TestCase[Name==\"Test\"]"); TestCase copyTestCase = (TestCase)search_result.First(); OwnedItem parentFolder = copyTestCase.ParentFolder; // parentFolder.CheckoutTree(); for (int i = 0; i < 10; i++) { parentFolder.Copy(copyTestCase); } //workspace.CheckInAll(""); workspace.Save(); Console.WriteLine(value: "Created folder and Test Cases Copied"); } }
/// <summary> /// Identify location of existing WSE Modules and create generic folder for storing API modules /// </summary> /// <param name="wseModule">Xmodule of WSE Engine</param> /// <returns></returns> public TCFolder CreateFolderForApiModules(XModule wseModule) { TCFolder parentFolder = wseModule.ParentFolder as TCFolder; TCFolder apiFolder = parentFolder?.CreateFolder(); if (apiFolder != null) { apiFolder.Name = $"API_{wseModule.Name}"; apiFolder.EnsureUniqueName(); } return(apiFolder); }