public void GetObjects() { Console.WriteLine(testlink.about()); var projects = testlink.GetProjects(); projects.ForEach(a => Console.WriteLine($"Project: {a.id}, {a.name}")); var project = projects.First(a => a.name == "CMGE"); var testPlans = testlink.GetProjectTestPlans(project.id); testPlans.ForEach(a => Console.WriteLine($"Test Plans: {a.id}, {a.name}")); var testSuites = testlink.GetFirstLevelTestSuitesForTestProject(project.id); testSuites.ForEach(a => Console.WriteLine($"Test Suites: {a.id}, {a.name}")); var testSuite = testSuites.First(); var testCases = testlink.GetTestCasesForTestSuite(testSuite.id, false); testCases.ForEach(a => Console.WriteLine($"Test Cases: {a.id}, {a.name}")); var testCase = testlink.GetTestCase(4510, 1); Console.WriteLine($"Test Case: {testCase.id}, {testCase.name}"); }
protected TestPlan GetTestPlan(string testPlanName) { plan = proxy.GetProjectTestPlans(ApiTestProjectId).FirstOrDefault(a => a.name == testPlanName); if (plan == null) { Assert.Fail("Setup failed, could not find test plan named '{0}' in project '{1}'", testPlanName, testProjectName); } return(plan); }
/// <summary> /// find a testplan within the automated test project sandbox /// </summary> /// <param name="testPlanName"></param> /// <returns></returns> protected TestPlan getTestPlan(string testPlanName) { List <TestPlan> plans = proxy.GetProjectTestPlans(ApiTestProjectId); //Assert.IsNotEmpty(plans, "Setup failed, couldn't find testplans for project {0}", testProjectName); plan = null; foreach (TestPlan candidate in plans) { if (candidate.name == testPlanName) { plan = candidate; break; } } if (plan == null) { Assert.Fail("Setup failed, could not find test plan named '{0}' in project '{1}'", testPlanName, testProjectName); } return(plan); }
/// <summary> /// update selected bits of the testlink fixture data /// </summary> /// <param name="newProject"></param> /// <param name="newTestPlan"></param> /// <param name="newTestSuite"></param> /// <returns>true if data have been set up successfully</returns> private bool updateData(bool newProject, bool newTestPlan, bool newTestSuite) { if (basicConnectionValid == false) { testProjectId = 0; testPlanId = 0; testSuiteId = 0; return(false); } if (newProject) { testProjectId = 0; AllTestPlans = new List <TestPlan>(); foreach (TestProject project in allProjects) { if (project.name == connectionData.ProjectName) { currentProject = project; testProjectId = project.id; AllTestPlans = proxy.GetProjectTestPlans(project.id); break; } } if (testProjectId == 0) { testPlanId = 0; testSuiteId = 0; Console.WriteLine("Test Project '{0}' was not found in TestLink", connectionData.ProjectName); return(false); } } else if (testProjectId == 0) // it was wrong and hasn't changed { return(false); } if (newTestPlan) { testPlanId = 0; foreach (TestPlan tp in AllTestPlans) { if (tp.name == connectionData.TestPlan) { testPlanId = tp.id; break; } } if (testPlanId == 0) { testSuiteId = 0; Console.WriteLine("Test plan '{0}' was not found in project '{1}'", connectionData.TestPlan, connectionData.ProjectName); return(false); } } else if (testPlanId == 0) // it was wrong and hasn't changed { return(false); } if (newTestSuite) { testSuiteId = GetTestSuiteId(testProjectId, connectionData.TestSuite); if (testSuiteId == 0) { Console.WriteLine("Test suite '{0}' was not found in project '{1}'", connectionData.TestSuite, connectionData.ProjectName); return(false); } } else if (testSuiteId == 0) // it was wrong and hasn't changed { return(false); } return(true); }