Meyn.TestLink.TestLink.GetFirstLevelTestSuitesForTestProject C# (CSharp) Method

GetFirstLevelTestSuitesForTestProject() public method

get all top level test suites for a test project
public GetFirstLevelTestSuitesForTestProject ( int testprojectid ) : List
testprojectid int
return List
        public List<TestSuite> GetFirstLevelTestSuitesForTestProject(int testprojectid)
        {
            stateIsValid();
            object[] response = proxy.getFirstLevelTestSuitesForTestProject(devkey, testprojectid);
            List<TLErrorMessage> errors = decodeErrors(response);
            List<TestSuite> result = new List<TestSuite>();
            if (errors.Count > 0) {
                if (errors[0].code != 7008)
                    // project has no test suites, we return an emptu result
                    handleErrorMessage(response);
            } else
                foreach (XmlRpcStruct data in response) {
                    result.Add(new TestSuite(data));
                }
            return result;
        }

Usage Example

Example #1
0
        /// <summary>
        /// retrieve the testsuite id
        /// </summary>
        /// <param name="tlfa"></param>
        /// <returns>0 or a valid test suite Id</returns>
        private int GetTestSuitedId(int projectId, string testSuiteName)
        {
            int testSuiteId             = 0;
            List <TestSuite> testSuites = proxy.GetFirstLevelTestSuitesForTestProject(projectId); //GetTestSuitesForTestPlan(testPlanId);

            // testsuite must exist. Currently no way of creating them
            foreach (TestSuite ts in testSuites)
            {
                if (ts.name == testSuiteName)
                {
                    testSuiteId = ts.id;
                    break;
                }
            }
            return(testSuiteId);
        }