static void Main(string[] args)
        {
            using (TCAPI tcapi = TCAPI.CreateInstance())
            {
                TCWorkspace     workspace      = tcapi.OpenWorkspace(@"C:\Users\estan\Desktop\trainings\TOSCA Customizations\Tosca Workspace\Training Customizations\Training Customizations.tws", "Admin", "");
                TCProject       project        = workspace.GetProject();
                List <TCObject> result         = project.Search($"=>SUBPARTS:TCFolder[UniqueId==\"{unique_id_test_case_folder}\"]");
                TCFolder        testCaseFolder = (TCFolder)result.First();
                testCaseFolder.Checkout();

                TestCase testCase = testCaseFolder.CreateTestCase();
                testCase.Name = "Test Creating Test Case";

                XModule tboxSetBuffer = (XModule)project.Search($"=>SUBPARTS:XModule[UniqueId==\"{unique_id_tbox_set_buffer}\"]").First();
                XModule tboxWait      = (XModule)project.Search($"=>SUBPARTS:XModule[UniqueId==\"{unique_id_tbox_wait}\"]").First();


                XTestStep      setBufferTestStep  = testCase.CreateXTestStepFromXModule(tboxSetBuffer);
                XTestStepValue setBUfferStepvalue = setBufferTestStep.CreateXTestStepValue(tboxSetBuffer.Attributes.First());
                setBUfferStepvalue.Name       = "Test Buffer Creation";
                setBUfferStepvalue.Value      = "42";
                setBUfferStepvalue.ActionMode = XTestStepActionMode.Input;

                XTestStep      tboxSetWaitTimeStep      = testCase.CreateXTestStepFromXModule(tboxWait);
                XTestStepValue tboxWaitSettimeStepValue = tboxSetWaitTimeStep.TestStepValues.First();
                tboxWaitSettimeStepValue.Value = "500";
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            TCAPI.CreateInstance(new Tricentis.TCAPIObjects.TCAPIConnectionInfo());
            Console.WriteLine("Enter the workspace path:");
            var path = Console.ReadLine();

            Console.WriteLine("Enter the username:"******"Enter the password:"******"Checkout succesful!");
            }
            else
            {
                Console.WriteLine("Workspace is already checked out!");
            }
            TCAPI.Instance.CloseWorkspace();
            TCAPI.CloseInstance();
        }
Пример #3
0
        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");
            }
        }
Пример #4
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            TCAPI.CreateInstance(new Tricentis.TCAPIObjects.TCAPIConnectionInfo());

            TCWorkspace workspace = TCAPI.Instance.OpenWorkspace(txtPath.Text, txtUser.Text, txtPassword.Text);
            TCProject   project   = workspace.GetProject();

            TestCase testCase = (TestCase)project.Search($"=>SUBPARTS:TestCase[Name==\"{txtTestCase.Text}\"]").FirstOrDefault();

            if (testCase != null)
            {
                TCFolder executionListFolder = (TCFolder)project.Search("=>SUBPARTS:TCFolder[PossibleContent==\"Folder;ExecutionList\"]").First();
                if (executionListFolder.IsTaskApplicable(TCTasks.Checkout))
                {
                    executionListFolder.Checkout();
                }
                ExecutionList executionList = executionListFolder.CreateExecutionList();
                executionList.Name = txtTestCase.Text;
                executionList.CreateExecutionEntry(testCase);
                if (executionListFolder.CheckOutState.Equals(CheckOutState.CheckedOut))
                {
                    workspace.CheckInAll("Execution list created from code!");
                }
                workspace.Save();
                MessageBox.Show("Execution list created successfully");
            }
            else
            {
                MessageBox.Show("TestCase not found!");
            }
            TCAPI.Instance.CloseWorkspace();
            TCAPI.CloseInstance();
        }
Пример #5
0
        private static TCFolder GetRootFolderForExecLists(TCWorkspace myWorkspace)
        {
            //Retrieve the project
            TCProject project = myWorkspace.GetProject();

            //SearchFor ExecutionListFolder
            TCFolder execListFolder = null;

            foreach (OwnedItem item in project.Items)
            {
                if (item.Name == EXLISTROOTNODE)
                {
                    execListFolder = item as TCFolder;
                    break;
                }
            }
            if (execListFolder == null)
            {
                Console.WriteLine("ExecutionList TopFolder was not found");
                return(null);
            }

            TCFolder execStartFolder = null;

            foreach (OwnedItem subfolder in execListFolder.Items)
            {
                if (String.Equals(ToscaReportGenerator.Default.mainExList, subfolder.Name, StringComparison.InvariantCultureIgnoreCase))
                {
                    execStartFolder = subfolder as TCFolder;
                    break;
                }
            }

            if (execStartFolder == null)
            {
                Console.WriteLine(String.Format("ExecutionFolder {0} was not found", ToscaReportGenerator.Default.mainExList));
                return(null);
            }

            return(execStartFolder);
        }
Пример #6
0
        private static TCFolder GetRootFolderForExecLists(TCWorkspace myWorkspace)
        {
            //Retrieve the project
            TCProject project = myWorkspace.GetProject();

            //SearchFor ExecutionListFolder
            TCFolder execListFolder = null;
            foreach (OwnedItem item in project.Items)
            {
                if (item.Name == EXLISTROOTNODE)
                {
                    execListFolder = item as TCFolder;
                    break;
                }
            }
            if (execListFolder == null)
            {
                Console.WriteLine("ExecutionList TopFolder was not found");
                return null;
            }

            TCFolder execStartFolder = null;
            foreach (OwnedItem subfolder in execListFolder.Items)
            {
                if (String.Equals(ToscaReportGenerator.Default.mainExList,subfolder.Name,StringComparison.InvariantCultureIgnoreCase ))
                {
                    execStartFolder = subfolder as TCFolder;
                    break;
                }
            }

            if (execStartFolder == null)
            {
                Console.WriteLine(String.Format("ExecutionFolder {0} was not found", ToscaReportGenerator.Default.mainExList));
                return null;
            }

            return execStartFolder;
        }