Ejemplo n.º 1
0
        public void ReportTCResultTest()
        {
            var testPlan  = testlink.getTestPlanByName("CMGE", "dev-nunit-test-plan");
            var testCases = testlink.GetTestCasesForTestPlan(testPlan.id);
            var testCase  = testCases.Last();

            testlink.ReportTCResult(testCase.tc_id, testPlan.id, TestCaseStatus.Failed, testCase.platform_id, testCase.platform_name, true, true, "notes");
            var result = testlink.GetLastExecutionResult(testPlan.id, testCase.tc_id);

            Assert.Equal("f", result.status);

            testlink.ReportTCResult(testCase.tc_id, testPlan.id, TestCaseStatus.Passed, testCase.platform_id, testCase.platform_name, true, true, "notes");
            result = testlink.GetLastExecutionResult(testPlan.id, testCase.tc_id);
            Assert.Equal("p", result.status);
        }
Ejemplo n.º 2
0
        public static bool ReportarCasoDePrueba(string urlTestlink, string keyTestlink, int idTestCaseInterno,
                                                int idTestCaseExterno, int idTestPlan, bool paso, int idBuild, string nombreBuild,
                                                string mensaje, int idPlataforma, string nombrePlataforma)
        {
            bool seEjecuto = false;

            try
            {
                var testlinkApi = new TestLink(keyTestlink, urlTestlink);
                testlinkApi.ReportTCResult(
                    idTestCaseInterno,
                    idTestPlan,
                    paso ? TestCaseStatus.Passed : TestCaseStatus.Failed,
                    idPlataforma,
                    nombrePlataforma,
                    false,
                    true,
                    mensaje,
                    idBuild,
                    0);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            return(seEjecuto);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// record a result with testlink;
        /// </summary>
        /// <param name="testCaseId"></param>
        /// <param name="status"></param>
        /// <param name="notes"></param>
        /// <returns></returns>
        public GeneralResult RecordTheResult(int testCaseId, TestCaseResultStatus status, string notes)
        {
            GeneralResult result = null;

            if (ConnectionValid == true)
            {
                result = proxy.ReportTCResult(testCaseId, testPlanId, status, platformName: platformName, notes: notes.ToString());
            }
            else
            {
                result = new GeneralResult("Invalid Connection", false);
            }
            return(result);
        }
Ejemplo n.º 4
0
 protected void PostTestResult(TestCaseResultStatus status)
 {
     try
     {
         tl.ReportTCResult(
             tl.GetTestCaseIDByName(TestName)[0].id,
             testPlanId,
             status,
             buildid: buildId); // it posts result for testcase.
     }
     catch (Exception ex)
     {
         //
     }
 }
Ejemplo n.º 5
0
        public void ProcessResult(
            string currentTestCaseName,
            string testProject,
            string testPlan,
            string status,
            string executionNotes
            )
        {
            try
            {
                //var currentTestCaseName = testContext.ScenarioInfo.Description.Replace("\t", "");
                //Getting the test case based on test project, test suite, test plan
                var testPlanRepository  = _testLink.getTestPlanByName(testProject, testPlan);
                var testCasesOfTestPlan = _testLink.GetTestCasesForTestPlan(testPlanRepository.id);

                var currentTestCaseRepository = _testLink.GetTestCaseIDByName(currentTestCaseName).Single();
                var testCaseRepository        = testCasesOfTestPlan.Where(a => a.tc_id == currentTestCaseRepository.id)
                                                .ToList().FirstOrDefault();

                var testCaseStatus = GetTestCaseStatus(status);

                if (testCaseRepository == null)
                {
                    Console.WriteLine("Cannot find test case in test plan");
                }
                else
                {
                    _testLink.ReportTCResult(
                        testCaseRepository.tc_id,
                        testPlanRepository.id,
                        testCaseStatus,
                        1,
                        "Timon",
                        false,
                        true,
                        executionNotes);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 6
0
        public void Run()
        {
            SetAdapter();
            SetPlan();
            var      result    = _wrappedTestCase.RunTest();
            TestCase currentTC = _apiAdapter.GetTestCase(_apiAdapter.GetTestCaseIDByName(_testCaseName, _testSuiteName)[0].id);

            Console.WriteLine(String.Format("Result: {0}. Message: {1}", result.Status, result.Message));
            try
            {
                _apiAdapter.ReportTCResult(currentTC.testcase_id, _testPlan.id, result.Status,
                                           platformId: _apiAdapter.GetTestPlanPlatforms(_testPlan.id).First(e => e.name == _testPlatformName).id,
                                           overwrite: false, notes: result.Message);

                Console.WriteLine("Test results successfully send to TestlinkServer");
            }
            catch (TestCaseException exeption)
            {
                Console.WriteLine("Test result can not be saved because TestCase (" + _testCaseName + "), TestSuit ("
                                  + _testSuiteName + ") does not exist for current TestPlan (" + _testPlanName
                                  + ") or TestPlatform (" + _testPlatformName + ")." + exeption.Message);
            }
        }
Ejemplo n.º 7
0
        public void ReportTestPass(int testCaseId, String message)
        {
            if (_buildVersion != 0)
            {
                testLink.ReportTCResult(testCaseId, _testPlanId, TestCaseResultStatus.Pass, 0, "test", false, true, message, _buildVersion, 0);
            }

            if (_buildVersion == 0)
            {
                testLink.ReportTCResult(testCaseId, _testPlanId, TestCaseResultStatus.Pass, 0, "test", false, true, message, 0, 0);
            }
        }