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(); }
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(); }
private static void CloseWorkspaceAndAPI() { Console.WriteLine("Closing Tosca Workspace"); //close the workspace TCAPI.Instance.CloseWorkspace(); //close the instance TCAPI.CloseInstance(); }