/// <summary> /// Imports the test suites and sections /// </summary> /// <param name="streamWriter"></param> /// <param name="spiraClient"></param> /// <param name="testRailApi"></param> private void ImportTestSuites(StreamWriter streamWriter, SpiraSoapService.SoapServiceClient spiraClient, TestLink testLinkApi, List <TestSuite> testSuites, int?parentTestFolderId = null) { //Get the test suites from the TestLink API if (testSuites != null) { foreach (TestSuite testSuite in testSuites) { //Extract the user data int testLinkId = testSuite.id; //Create the new SpiraTest test folder RemoteTestCaseFolder remoteTestFolder = new RemoteTestCaseFolder(); remoteTestFolder.Name = testSuite.name; remoteTestFolder.ParentTestCaseFolderId = parentTestFolderId; int newTestCaseFolderId = spiraClient.TestCase_CreateFolder(remoteTestFolder).TestCaseFolderId.Value; streamWriter.WriteLine("Added test suite: " + testLinkId); //Add to the mapping hashtables if (!this.testSuiteMapping.ContainsKey(testLinkId)) { this.testSuiteMapping.Add(testLinkId, newTestCaseFolderId); } //See if this test suite has any child test suites List <TestSuite> childTestSuites = testLinkApi.GetTestSuitesForTestSuite(testLinkId); if (childTestSuites != null && childTestSuites.Count > 0) { ImportTestSuites(streamWriter, spiraClient, testLinkApi, childTestSuites, newTestCaseFolderId); } } } }
public void GetCustomField() { var project = testlink.GetProject("CMGE"); var firtRootTestSuite = testlink.GetFirstLevelTestSuitesForTestProject(project.id).First(); var testSuites = testlink.GetTestSuitesForTestSuite(firtRootTestSuite.id); testSuites.ForEach(ts => { Console.WriteLine($"Test Suite: {ts.id}, {ts.name}"); var testCases = testlink.GetTestCasesForTestSuite(ts.id, false); testCases.ForEach(tc => { var testCase = testlink.GetTestCase(tc.id); var product = testlink.GetCustomFileds(testCase.testcase_id, testCase.externalid, testCase.version, project.id, "Product"); var ef = testlink.GetCustomFileds(testCase.testcase_id, testCase.externalid, testCase.version, project.id, "ExecutionFramework"); Console.WriteLine($"Test Case: {tc.id}, {tc.name}, Product: {product}, ExecutionFramework: {ef}"); }); }); }