Description of TLSCmdletBase.
Inheritance: Tmx.CommonCmdletBase
Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
0
        public static void GetTestPlan(TLSCmdletBase cmdlet, 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 (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);
            }
        }
Ejemplo n.º 3
0
 public static void GetProjectByName(TLSCmdletBase cmdlet, string[] projectNames)
 {
     cmdlet.WriteObject(
         cmdlet,
         GetProjectsByName(
             cmdlet,
             projectNames));
 }
Ejemplo n.º 4
0
 public static void GetProjectById(TLSCmdletBase cmdlet, string[] projectIds)
 {
     cmdlet.WriteObject(
         cmdlet,
         GetProjectsById(
             cmdlet,
             projectIds));
 }
Ejemplo n.º 5
0
        public static void GetBuild(
            TLSCmdletBase cmdlet,
            TestPlan[] testPlans,
            string[] buildNames)
        {
            string testPlanNameNow = string.Empty;

            WildcardOptions options =
                WildcardOptions.IgnoreCase |
                WildcardOptions.Compiled;

            try {
                foreach (TestPlan testPlan in testPlans)
                {
                    testPlanNameNow = testPlan.name;

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

                    if (null == buildNames || 0 == buildNames.Length)
                    {
                        cmdlet.WriteObject(
                            cmdlet,
                            buildsList);
                    }
                    else
                    {
                        foreach (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);
            }
        }
Ejemplo n.º 6
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,
            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
        }
Ejemplo n.º 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.
 }
Ejemplo n.º 8
0
        public static void GetTestPlans(TLSCmdletBase cmdlet, 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);
            }
        }
Ejemplo n.º 9
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);
            }
        }
Ejemplo n.º 10
0
        internal static TestProject[] GetProjectsByName(TLSCmdletBase cmdlet, string[] projectNames)
        {
            System.Collections.Generic.List <TestProject> resultList =
                new System.Collections.Generic.List <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);
            }

            TestProject[] resultArray =
                resultList.ToArray();

            return(resultArray);
        }
Ejemplo n.º 11
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);
            }
        }
Ejemplo n.º 12
0
        internal static TestProject[] GetProjectsById(TLSCmdletBase cmdlet, string[] projectIds)
        {
            System.Collections.Generic.List <TestProject> resultList =
                new System.Collections.Generic.List <TestProject>();

            string projectIdNow = string.Empty;

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

                cmdlet.WriteVerbose(cmdlet, "iterating through the project colection");
                foreach (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);
            }

            TestProject[] resultArray =
                resultList.ToArray();

            return(resultArray);
        }
Ejemplo n.º 13
0
        public static void GetTestCaseFromProject(TLSCmdletBase cmdlet, TestProject[] testProjects, string[] testCaseNames)
        {
            foreach (TestProject project in testProjects)
            {
                System.Collections.Generic.List <TestPlan> testPlans =
                    TLAddinData.CurrentTestLinkConnection.GetProjectTestPlans(project.id);

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

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

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

//                foreach (Meyn.TestLink.TestSuite suite in firstLevelTestSuites) {
//
//
//                }
            }
        }
Ejemplo n.º 14
0
//
        public static void GetTestCaseFromTestPlan(TLSCmdletBase cmdlet, TestPlan[] testPlans, string[] testCaseNames)
        {
            foreach (TestPlan testPlan in testPlans)
            {
                System.Collections.Generic.List <TestCaseFromTestPlan> testCases =
                    TLAddinData.CurrentTestLinkConnection.GetTestCasesForTestPlan(testPlan.id);

                if (null != testCaseNames && 0 < testCaseNames.Length)
                {
                    foreach (TestCaseFromTestPlan testCase in testCases)
                    {
                        cmdlet.WriteObject(cmdlet, testCase);
                    }
                }
                else
                {
                    cmdlet.WriteObject(cmdlet, testCases);
                }
            }
        }
Ejemplo n.º 15
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);
 }
Ejemplo n.º 16
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);
            }
        }
Ejemplo n.º 17
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) {
//                    
//                    
//                }
            }
        }
Ejemplo n.º 18
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);
            }
        }
Ejemplo n.º 19
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;
        }
Ejemplo n.º 20
0
 internal TLSrvGetProjectCommand(TLSCmdletBase cmdlet) : base (cmdlet)
 {
 }
Ejemplo n.º 21
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();
        }
Ejemplo n.º 22
0
 public static void AddTestSuite(TLSCmdletBase cmdlet, string[] name)
 {
     //
 }
Ejemplo n.º 23
0
 internal TLSrvGetTestCaseCommand(TLSCmdletBase cmdlet) : base (cmdlet)
 {
 }
Ejemplo n.º 24
0
 public static void GetTestCaseFromTestSuite(TLSCmdletBase cmdlet, TestSuite[] testSuites, string[] testCaseNames, bool deep)
 {
     foreach (TestSuite testSuite in testSuites) {
         
         System.Collections.Generic.List<TestCaseFromTestSuite> testCases =
             TLAddinData.CurrentTestLinkConnection.GetTestCasesForTestSuite(testSuite.id, deep);
         
         if (null != testCaseNames && 0 < testCaseNames.Length) {
             
             foreach (TestCaseFromTestSuite testCase in testCases) {
                 
                 cmdlet.WriteObject(cmdlet, testCase);
             }
         } else {
             
             cmdlet.WriteObject(cmdlet, testCases);
         }
     }
 }
Ejemplo n.º 25
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);
     }
 }
Ejemplo n.º 26
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;
        }
Ejemplo n.º 27
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);
            }
        }
Ejemplo n.º 28
0
        public static void GetProjectById(TLSCmdletBase cmdlet, string[] projectIds)
        {

            cmdlet.WriteObject(
                cmdlet,
                TLHelper.GetProjectsById(
                    cmdlet,
                    projectIds));

        }
Ejemplo n.º 29
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();
        }
Ejemplo n.º 30
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);
            }
        }
Ejemplo n.º 31
0
 public static void GetProjectByName(TLSCmdletBase cmdlet, string[] projectNames)
 {
     cmdlet.WriteObject(
         cmdlet,
         GetProjectsByName(
             cmdlet,
             projectNames));
 }
Ejemplo n.º 32
0
 public static void AddTestSuite(TLSCmdletBase cmdlet, string[] name)
 {
     //
 }
Ejemplo n.º 33
0
 internal TLSrvAddTestSuiteCommand(TLSCmdletBase cmdlet) : base (cmdlet)
 {
 }
Ejemplo n.º 34
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
        }
Ejemplo n.º 35
0
 internal TLSrvNewUserCommand(TLSCmdletBase cmdlet) : base (cmdlet)
 {
 }
Ejemplo n.º 36
0
//        
        public static void GetTestCaseFromTestPlan(TLSCmdletBase cmdlet, Meyn.TestLink.TestPlan[] testPlans, string[] testCaseNames)
        {
            foreach (Meyn.TestLink.TestPlan testPlan in testPlans) {
                
                System.Collections.Generic.List<Meyn.TestLink.TestCaseFromTestPlan> testCases =
                    TLAddinData.CurrentTestLinkConnection.GetTestCasesForTestPlan(testPlan.id);
                
                if (null != testCaseNames && 0 < testCaseNames.Length) {
                    
                    foreach (Meyn.TestLink.TestCaseFromTestPlan testCase in testCases) {
                        
                        cmdlet.WriteObject(cmdlet, testCase);
                    }
                } else {
                    
                    cmdlet.WriteObject(cmdlet, testCases);
                }
            }
        }
Ejemplo n.º 37
0
 public TLSrvAddBuildCommand(TLSCmdletBase cmdlet) : base (cmdlet)
 {
 }
Ejemplo n.º 38
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);
            }
        }
Ejemplo n.º 39
0
 internal TLSrvGetBuildCommand(TLSCmdletBase cmdlet) : base(cmdlet)
 {
 }
Ejemplo n.º 40
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.
 }
Ejemplo n.º 41
0
 internal TLSrvCommand(TLSCmdletBase cmdlet)
 {
     this.Cmdlet = cmdlet;
 }
Ejemplo n.º 42
0
 internal TLSrvGetBuildCommand(TLSCmdletBase cmdlet) : base (cmdlet)
 {
 }
Ejemplo n.º 43
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 <TestSuite> testSuites =
                new System.Collections.Generic.List <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 <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 <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 (TestSuite firstLevelTestSuite in firstLevelTestSuites)
                        {
                            cmdlet.WriteVerbose(
                                cmdlet,
                                "getting down-level test suites from the test suite '" +
                                firstLevelTestSuite.name +
                                "'.");

                            System.Collections.Generic.List <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 <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);
        }
Ejemplo n.º 44
0
 internal TLSrvConnectCommand(TLSCmdletBase cmdlet) : base (cmdlet)
 {
 }
Ejemplo n.º 45
0
 internal TLSrvNewTestPlanCommand(TLSCmdletBase cmdlet) : base (cmdlet)
 {
 }