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}");
        }
Exemple #2
0
 /// <summary>
 /// create the basic connection and test it out
 /// </summary>
 /// <param name="devKey"></param>
 /// <param name="url"></param>
 /// <returns>true if the connection is valid</returns>
 private bool basicConnection(string devKey, string url)
 {
     lastException = null;
     proxy         = new TestLink(connectionData.DevKey, connectionData.Url);
     AllTestPlans  = new List <TestPlan>();
     try
     {
         allProjects = proxy.GetProjects();
     }
     catch (TestLinkException tlex)
     {
         lastException = tlex;
         Console.WriteLine("Failed to connect to TestLink at {1}. Message was '{0}'", tlex.Message, url);
         return(false);
     }
     return(true);
 }
Exemple #3
0
        /// <summary>
        /// Authenticates the user from the providing server/login/password information
        /// </summary>
        /// <param name="sender">The sending object</param>
        /// <param name="e">The event arguments</param>
        private void btnAuthenticate_Click(object sender, System.EventArgs e)
        {
            //Disable the next button
            this.btnNext.Enabled = false;

            //Make sure that a login was entered
            if (this.txtLogin.Text.Trim() == "")
            {
                MessageBox.Show("You need to enter a login", "Authentication Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            //Make sure that a server was entered
            if (this.txtServer.Text.Trim() == "")
            {
                MessageBox.Show("You need to enter the URL to your TestLink instance", "Authentication Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            try
            {
                //Instantiate the connection to TestLink (by getting a list of projects)
                string             apiKey   = this.txtLogin.Text.Trim();
                string             url      = this.txtServer.Text.Trim() + Utils.TESTLINK_URL_SUFFIX_XML_RPC;
                TestLink           testLink = new TestLink(apiKey, url);
                List <TestProject> projects = testLink.GetProjects();

                if (projects.Count > 0)
                {
                    MessageBox.Show("You have logged into TestLink Successfully", "Authentication", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("You have logged into TestLink successfully, but you don't have any projects to import!", "No Projects Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                //Now we need to populate the list of projects
                List <NameIdObject> projectsList = new List <NameIdObject>();
                //Convert into a standard bindable list source
                for (int i = 0; i < projects.Count; i++)
                {
                    NameIdObject project = new NameIdObject();
                    project.Id   = projects[i].id.ToString();
                    project.Name = projects[i].name;
                    projectsList.Add(project);
                }

                //Sort by name
                projectsList = projectsList.OrderBy(p => p.Name).ToList();

                this.cboProject.DisplayMember = "Name";
                this.cboProject.DataSource    = projectsList;

                //Enable the Next button
                this.btnNext.Enabled = true;
            }
            catch (Exception exception)
            {
                MessageBox.Show("General error accessing the TestLink API. The error message is: " + exception.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }