예제 #1
0
        //        public static void OpenTestCase(TLSCmdletBase cmdlet, string name)
        //        {
        //            throw new NotImplementedException();
        //        }
        public static void AddBuild(
            TLSCmdletBase cmdlet,
            TestPlan[] testPlans,
            string buildName,
            string buildNote)
        {
            try {

                for (int j = 0; j < testPlans.Length; j++) {

                    string description = string.Empty;

                    if (null != buildNote && string.Empty != buildNote) {

                        description = buildNote;
                    }

                    GeneralResult result =
                        TLAddinData.CurrentTestLinkConnection.CreateBuild(
                            testPlans[j].id,
                            buildName,
                            description);

                    if (result.status) {

                        cmdlet.WriteObject(
                            cmdlet,
                            TLAddinData.CurrentTestLinkConnection.GetLatestBuildForTestPlan(testPlans[j].id));

                    }

                }

            }
            catch (Exception eAddBuild) {
                cmdlet.WriteError(
                    cmdlet,
                    "Couldn't create a build '" +
                    buildName +
                    "'. " +
                    eAddBuild.Message,
                    "" +
                    "CouldNotCreateBuild",
                    ErrorCategory.InvalidResult,
                    true);
            }
        }
예제 #2
0
        public static void GetTestSuite(TLSCmdletBase cmdlet, string[] suiteNames)
        {
            System.Collections.Generic.List<string> testSuiteNames =
                new System.Collections.Generic.List<string>();
            foreach (string suiteName in suiteNames) {
                testSuiteNames.Add(suiteName);
            }

            System.Collections.Generic.List<Meyn.TestLink.TestSuite> testSuites =
                new System.Collections.Generic.List<Meyn.TestLink.TestSuite>();

            // getting test projects
            System.Collections.Generic.List<TestProject> testProjects =
                TLAddinData.CurrentTestLinkConnection.GetProjects();

            // getting first level test suites
            if (null != testProjects && 0 < testProjects.Count) {

                cmdlet.WriteVerbose(
                    cmdlet,
                    "Found " +
                    testProjects.Count.ToString() +
                    " projects.");

                foreach (TestProject testProject in testProjects) {

                    cmdlet.WriteVerbose(
                        cmdlet,
                        "getting first level test suites from the project '" +
                        testProject.name +
                        ",.");
                    System.Collections.Generic.List<Meyn.TestLink.TestSuite> firstLevelTestSuites =
                        TLAddinData.CurrentTestLinkConnection.GetFirstLevelTestSuitesForTestProject(testProject.id);

                    if (null != firstLevelTestSuites && 0 < firstLevelTestSuites.Count) {

                        cmdlet.WriteVerbose(
                            cmdlet,
                            "There are " +
                            firstLevelTestSuites.Count.ToString() +
                            " first-level test suites in the project '" +
                            testProject.name +
                            "'.");

                        foreach (string  testSuiteName in testSuiteNames) {
                            System.Collections.Generic.List<Meyn.TestLink.TestSuite> suitesThatMatch =
                                firstLevelTestSuites.FindAll(s => s.name == testSuiteName);
                            if (null != suitesThatMatch && 0 < suitesThatMatch.Count) {

                                cmdlet.WriteVerbose(
                                    cmdlet,
                                    "There are " +
                                    suitesThatMatch.Count.ToString() +
                                    " first-level test suites that match names.");

                                testSuites.AddRange(suitesThatMatch);
                            }
                        }

                        // getting down-level test suites
                        foreach (Meyn.TestLink.TestSuite firstLevelTestSuite in firstLevelTestSuites) {

                            cmdlet.WriteVerbose(
                                cmdlet,
                                "getting down-level test suites from the test suite '" +
                                firstLevelTestSuite.name +
                                "'.");

                            System.Collections.Generic.List<Meyn.TestLink.TestSuite> downLevelTestSuites =
                                TLAddinData.CurrentTestLinkConnection.GetTestSuitesForTestSuite(firstLevelTestSuite.id);

                            if (null != downLevelTestSuites && 0 < downLevelTestSuites.Count) {

                                cmdlet.WriteVerbose(
                                    cmdlet,
                                    "There are " +
                                    downLevelTestSuites.Count.ToString() +
                                    " down-level test suites in the first-level test suite '" +
                                    firstLevelTestSuite.name +
                                    "'.");

                                foreach (string testSuiteName in testSuiteNames) {
                                    System.Collections.Generic.List<Meyn.TestLink.TestSuite> dlSuitesThatMatch =
                                        downLevelTestSuites.FindAll(d => d.name == testSuiteName);
                                    if (null != dlSuitesThatMatch && 0 < dlSuitesThatMatch.Count) {

                                        cmdlet.WriteVerbose(
                                            cmdlet,
                                            "There are " +
                                            dlSuitesThatMatch.Count.ToString() +
                                            " down-level test suites that match names.");

                                        testSuites.AddRange(dlSuitesThatMatch);
                                    }
                                }

                            }

                        }

                    }

                }

            }

            // outputting the test suites collections
            cmdlet.WriteObject(cmdlet, testSuites);
        }
예제 #3
0
        public static void GetTestPlans(TLSCmdletBase cmdlet, Meyn.TestLink.TestProject[] testProjects)
        {
            try {

                for (int i = 0; i < testProjects.Length; i++) {

                    if (null == testProjects[i]) {
                        if (null != TLAddinData.CurrentTestProject) {
                            testProjects[i] = TLAddinData.CurrentTestProject;
                        } else {
                            cmdlet.WriteError(
                                cmdlet,
                                "You must specify a test project.",
                                "NoTestProjectSpecified",
                                ErrorCategory.InvalidArgument,
                                true);
                        }
                    }

                    System.Collections.Generic.List<TestPlan> listTestPlans =
                        TLAddinData.CurrentTestLinkConnection.GetProjectTestPlans(
                            testProjects[i].id);

                    foreach (TestPlan tplan in listTestPlans) {

                        TLAddinData.CurrentTestPlan =
                            tplan;

                    }

                    cmdlet.WriteObject(cmdlet, listTestPlans);

                }

            }
            catch (Exception eGetTestPlans) {
                cmdlet.WriteError(
                    cmdlet,
                    "Couldn't get test plans. " +
                    eGetTestPlans.Message,
                    "" +
                    "CouldNotCreateTestPlan",
                    ErrorCategory.InvalidResult,
                    true);
            }
        }
예제 #4
0
 internal TLSrvConnectCommand(TLSCmdletBase cmdlet)
     : base(cmdlet)
 {
 }
예제 #5
0
 internal TLSrvGetProjectCommand(TLSCmdletBase cmdlet)
     : base(cmdlet)
 {
 }
예제 #6
0
 internal TLSrvGetTestPlanCommand(TLSCmdletBase cmdlet)
     : base(cmdlet)
 {
 }
예제 #7
0
 internal static void NewUser(
     TLSCmdletBase cmdlet,
     string login,
     string password,
     string firstName,
     string lastName,
     string email,
     string role,
     string locale,
     bool active,
     bool disabled)
 {
     //TLAddinData.CurrentTestLinkConnection.
 }
예제 #8
0
        internal static Meyn.TestLink.TestProject[] GetProjectsByName(TLSCmdletBase cmdlet, string[] projectNames)
        {
            System.Collections.Generic.List<Meyn.TestLink.TestProject> resultList =
                new System.Collections.Generic.List<Meyn.TestLink.TestProject>();

            string projectNameNow = string.Empty;

            try {

                cmdlet.WriteVerbose(cmdlet, "iterating through the project names collection");
                foreach (string name in projectNames) {

                    cmdlet.WriteVerbose(cmdlet, name);
                    projectNameNow = name;

                    cmdlet.WriteVerbose(cmdlet, "getting project '" + projectNameNow + "'.");
                    TestProject testProject =
                        TLAddinData.CurrentTestLinkConnection.GetProject(projectNameNow);

                    if (null != testProject) {
                        TLAddinData.CurrentTestProject = testProject;
                        cmdlet.WriteVerbose(cmdlet, "got the project '" + testProject.name + "'.");
                    }
                    resultList.Add(TLAddinData.CurrentTestProject);
                }

            }
            catch (Exception eProject) {
                cmdlet.WriteError(
                    cmdlet,
                    "Unable to get the project '" +
                    projectNameNow +
                    "'. " +
                    eProject.Message,
                    "UnableToGetProject",
                    ErrorCategory.InvalidResult,
                    true);
            }

            Meyn.TestLink.TestProject[] resultArray =
                resultList.ToArray();

            return resultArray;
        }
예제 #9
0
 public static void GetProjectByName(TLSCmdletBase cmdlet, string[] projectNames)
 {
     cmdlet.WriteObject(
         cmdlet,
         TLHelper.GetProjectsByName(
             cmdlet,
             projectNames));
 }
예제 #10
0
        public static void GetBuild(
            TLSCmdletBase cmdlet,
            TestPlan[] testPlans,
            string[] buildNames)
        {
            string testPlanNameNow = string.Empty;

            WildcardOptions options =
                WildcardOptions.IgnoreCase |
                WildcardOptions.Compiled;

            try {

                foreach (Meyn.TestLink.TestPlan testPlan in testPlans) {

                    testPlanNameNow = testPlan.name;

                    System.Collections.Generic.List<Meyn.TestLink.Build> buildsList =
                        TLAddinData.CurrentTestLinkConnection.GetBuildsForTestPlan(testPlan.id);

                    if (null == buildNames || 0 == buildNames.Length) {
                        cmdlet.WriteObject(
                            cmdlet,
                            buildsList);
                    } else {

                        foreach (Meyn.TestLink.Build build in buildsList) {

                            foreach (string buildName in buildNames) {

                                if ((new WildcardPattern(buildName, options)).IsMatch(build.name)) {

                                    cmdlet.WriteObject(
                                        cmdlet,
                                        build);

                                }
                            }

                        }

                    }
                }

            }
            catch (Exception eGetBuild) {
                cmdlet.WriteError(
                    cmdlet,
                    "Couldn't get builds from  '" +
                    testPlanNameNow +
                    "'. " +
                    eGetBuild.Message,
                    "" +
                    "CouldNotGetBuild",
                    ErrorCategory.InvalidResult,
                    true);
            }
        }
예제 #11
0
 public static void AddTestSuite(TLSCmdletBase cmdlet, string[] name)
 {
     //
 }
예제 #12
0
 //public static IStaticTestSuite OpenTesSuite(TLSCmdletBase cmdlet, string name)
 //        public static object OpenTesSuite(TLSCmdletBase cmdlet, string name)
 //        {
 //            throw new NotImplementedException();
 //        }
 public static void AddTestSubSuite(TLSCmdletBase cmdlet, string[] name)
 {
     throw new NotImplementedException();
 }
예제 #13
0
 internal TLSrvGetBuildCommand(TLSCmdletBase cmdlet)
     : base(cmdlet)
 {
 }
예제 #14
0
 internal TLSrvNewUserCommand(TLSCmdletBase cmdlet)
     : base(cmdlet)
 {
 }
예제 #15
0
        public static void NewTestPlan(
            TLSCmdletBase cmdlet, 
            string testPlanName,
            string testPlanNotes,
            bool active)
        {
            try {

                string description = string.Empty;
                if (null != testPlanNotes && string.Empty != testPlanNotes) {
                    description = testPlanNotes;
                }

                GeneralResult result =
                    TLAddinData.CurrentTestLinkConnection.CreateTestPlan(
                        testPlanName,
                        TLAddinData.CurrentTestProject.name,
                        description,
                        //activePlan);
                        active);

                if (result.status) {
                    TLAddinData.CurrentTestPlan =
                        TLAddinData.CurrentTestLinkConnection.getTestPlanByName(
                            TLAddinData.CurrentTestProject.name,
                            testPlanName);
                }
                cmdlet.WriteObject(cmdlet, TLAddinData.CurrentTestPlan);

            }
            catch (Exception eNewTestPlan) {
                cmdlet.WriteError(
                    cmdlet,
                    "Couldn't create a test plan '" +
                    testPlanName +
                    "'. " +
                    eNewTestPlan.Message,
                    "" +
                    "CouldNotCreateTestPlan",
                    ErrorCategory.InvalidResult,
                    true);
            }
        }
예제 #16
0
        internal static Meyn.TestLink.TestProject[] GetProjectsById(TLSCmdletBase cmdlet, string[] projectIds)
        {
            System.Collections.Generic.List<Meyn.TestLink.TestProject> resultList =
                new System.Collections.Generic.List<Meyn.TestLink.TestProject>();

            string projectIdNow = string.Empty;

            try {

                cmdlet.WriteVerbose(cmdlet, "collecting all projects");
                System.Collections.Generic.List<Meyn.TestLink.TestProject> projectsList =
                    TLAddinData.CurrentTestLinkConnection.GetProjects();

                cmdlet.WriteVerbose(cmdlet, "iterating through the project colection");
                foreach (Meyn.TestLink.TestProject testProject in projectsList) {

                    cmdlet.WriteVerbose(cmdlet, "iterating through the project ids colection");
                    foreach (string id in projectIds) {

                        if (Convert.ToInt32(id) == testProject.id) {

                            TLAddinData.CurrentTestProject = testProject;
                            cmdlet.WriteVerbose(cmdlet, "got the project '" + testProject.name + "'.");

                            resultList.Add(testProject);
                        }
                    }
                }

            }
            catch (Exception eProject) {
                cmdlet.WriteError(
                    cmdlet,
                    "Unable to get the project by id. " +
                    eProject.Message,
                    "UnableToGetProject",
                    ErrorCategory.InvalidResult,
                    true);
            }

            Meyn.TestLink.TestProject[] resultArray =
                resultList.ToArray();

            return resultArray;
        }
예제 #17
0
        public static void GetProjectCollection(TLSCmdletBase cmdlet)
        {
            try {

                cmdlet.WriteVerbose(cmdlet, "GetProjectCollection: getting list of projects");
                System.Collections.Generic.List<TestProject> listProjects =
                    TLAddinData.CurrentTestLinkConnection.GetProjects();

                cmdlet.WriteVerbose(cmdlet, "GetProjectCollection: outputting projects");
                cmdlet.WriteObject(cmdlet, listProjects);

                // 20130131
                if (null != listProjects && 0 < listProjects.Count) {
                    cmdlet.WriteVerbose(cmdlet, "GetProjectCollection: settiing the current test project");
                    TLAddinData.CurrentTestProject =
                        listProjects[listProjects.Count -1];
                }
            }
            catch (Exception eProjectCollection) {
                cmdlet.WriteError(
                    cmdlet,
                    "Unable to get the list of projects. " +
                    eProjectCollection.Message,
                    "UnableToGetProjects",
                    ErrorCategory.InvalidResult,
                    true);
            }
        }
예제 #18
0
        //        public static void GetTestSubSuite(TLSCmdletBase cmdlet, string name)
        //        {
        //            throw new NotImplementedException();
        //        }
        //        public static void OpenTestSubSuite(TLSCmdletBase cmdlet, string name)
        //        {
        //            throw new NotImplementedException();
        //        }
        public static void AddTestCase(
            TLSCmdletBase cmdlet, 
            string name,
            string authorLogin,
            int suiteId,
            int testProjectId,
            string summary,
            string[] keyword,
            int order,
            bool checkDuplicatedName,
            Meyn.TestLink.ActionOnDuplicatedName actionDuplicatedName,
            int executionType,
            int importance)
        {
            string keywords = string.Empty;
            if (null != keyword && 0 < keyword.Length) {
                foreach (string singleKeyword in keyword) {
                    keywords += singleKeyword;
                }
            }

            if (null == TLAddinData.CurrentTestProject) {
                //
            Console.WriteLine("!!!");
                //
            }

            if (null == actionDuplicatedName) {
                actionDuplicatedName = ActionOnDuplicatedName.CreateNewVersion;
            }

            TLAddinData.CurrentTestLinkConnection.CreateTestCase(
                authorLogin,
                suiteId,
                name,
                testProjectId,
                summary,
                keywords,
                order,
                checkDuplicatedName,
                actionDuplicatedName,
                executionType,
                importance);
            //

            //TLAddinData.CurrentTestLinkConnection.ReportTCResult
        }
예제 #19
0
        public static void GetTestCaseFromProject(TLSCmdletBase cmdlet, Meyn.TestLink.TestProject[] testProjects, string[] testCaseNames)
        {
            foreach (Meyn.TestLink.TestProject project in testProjects) {

                System.Collections.Generic.List<Meyn.TestLink.TestPlan> testPlans =
                    TLAddinData.CurrentTestLinkConnection.GetProjectTestPlans(project.id);

                TLHelper.GetTestCaseFromTestPlan(cmdlet, testPlans.ToArray(), testCaseNames);

                System.Collections.Generic.List<Meyn.TestLink.TestSuite> firstLevelTestSuites =
                    TLAddinData.CurrentTestLinkConnection.GetFirstLevelTestSuitesForTestProject(project.id);

                TLHelper.GetTestCaseFromTestSuite(cmdlet, firstLevelTestSuites.ToArray(), testCaseNames, true);

            //                foreach (Meyn.TestLink.TestSuite suite in firstLevelTestSuites) {
            //
            //
            //                }
            }
        }
예제 #20
0
 public TLSrvAddBuildCommand(TLSCmdletBase cmdlet)
     : base(cmdlet)
 {
 }
예제 #21
0
        public static void GetTestCaseFromTestSuite(TLSCmdletBase cmdlet, Meyn.TestLink.TestSuite[] testSuites, string[] testCaseNames, bool deep)
        {
            foreach (Meyn.TestLink.TestSuite testSuite in testSuites) {

                System.Collections.Generic.List<Meyn.TestLink.TestCaseFromTestSuite> testCases =
                    TLAddinData.CurrentTestLinkConnection.GetTestCasesForTestSuite(testSuite.id, deep);

                if (null != testCaseNames && 0 < testCaseNames.Length) {

                    foreach (Meyn.TestLink.TestCaseFromTestSuite testCase in testCases) {

                        cmdlet.WriteObject(cmdlet, testCase);
                    }
                } else {

                    cmdlet.WriteObject(cmdlet, testCases);
                }
            }
        }
예제 #22
0
 internal TLSrvCommand(TLSCmdletBase cmdlet)
 {
     this.Cmdlet = cmdlet;
 }
예제 #23
0
        public static void GetTestPlan(TLSCmdletBase cmdlet, Meyn.TestLink.TestProject[] testProjects, string[] testPlanNames)
        {
            string testPlanNameNow = string.Empty;

            try {

            //                if (null == testProjects || 0 == testProjects.Length) {
            //                    if (null != TLAddinData.CurrentTestProject) {
            //                        testProjects = new Meyn.TestLink.TestProject[1];
            //                        testProjects[0] = TLAddinData.CurrentTestProject;
            //                    }
            //                }

                if (null == testProjects || 0 == testProjects.Length) {
                    //cmdlet.WriteObject(cmdlet, null); // ??
                    return;
                }

                foreach (Meyn.TestLink.TestProject testProject in testProjects) {
                    foreach (string name in testPlanNames) {

                        testPlanNameNow = name;

                        cmdlet.WriteVerbose(
                            cmdlet,
                            "Trying to get test plan '" +
                            testPlanNameNow +
                            "' from the project '" +
                            testProject.name +
                            "'.");

                        TestPlan testPlan =
                            TLAddinData.CurrentTestLinkConnection.getTestPlanByName(
                                testProject.name,
                                testPlanNameNow);

                        if (null != testPlan) {

                            TLAddinData.CurrentTestPlan = testPlan;

                            cmdlet.WriteObject(cmdlet, testPlan);
                        }

                    }
                }
            }
            catch (Exception eGetTestPlan) {
                cmdlet.WriteError(
                    cmdlet,
                    "Couldn't get test plan '" +
                    testPlanNameNow +
                    "'. " +
                    eGetTestPlan.Message,
                    "" +
                    "CouldNotCreateTestPlan",
                    ErrorCategory.InvalidResult,
                    true);
            }
        }
예제 #24
0
 internal TLSrvAddTestCaseCommand(TLSCmdletBase cmdlet)
     : base(cmdlet)
 {
 }
예제 #25
0
 internal TLSrvGetTestSuiteCommand(TLSCmdletBase cmdlet)
     : base(cmdlet)
 {
 }