public void shouldFailBecauseOfNullDevKey() { proxy = new TestLink(null, testlinkUrl); var tcidList = proxy.GetTestCaseIDByName("10 G shock"); Assert.Catch <XmlRpcServerException>(() => proxy.SayHello()); Assert.Fail("Did not cause an exception"); }
public void shouldFailBecauseOfNullDevKey() { proxy = new TestLink(null, targetDBUrl); List <TestCaseId> tcidList = proxy.GetTestCaseIDByName("10 G shock"); string result = proxy.SayHello(); Assert.AreNotEqual("Hello!", result, "Unexpected Server Response"); Assert.Fail("Did not cause an exception"); }
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) { // } }
public void CreateTestCase() { var project = testlink.GetProject("CMGE"); var testSuites = testlink.GetFirstLevelTestSuitesForTestProject(project.id); testSuites.ForEach(a => Console.WriteLine($"Test Suites: {a.id}, {a.name}")); var testSuite = testSuites.First(); var created = testlink.CreateTestCase("user", testSuite.id, "新创建的测试用例", project.id, "summary", new[] { new TestStep(1, "<p>click(<img alt=\"\" src=\"http://dev-wiki-1.cmit.local/resources/assets/cmgos.png \" style=\"height:71px; width:139px\" />)</p>", "find", true, 2) }, "", 1, false, ActionOnDuplicatedName.CreateNewVersion, 0, 0); Console.WriteLine($"{created.id}, {created.additionalInfo.has_duplicate}, {created.status}, {created.message}, {created.operation}"); var testCases = testlink.GetTestCaseIDByName("新创建的测试用例"); Assert.NotEmpty(testCases); }
/// <summary> /// get the test case by this name in this particular test suite /// </summary> /// <param name="testCaseName"></param> /// <param name="testSuiteId">the test suite the test case has to be in</param> /// <returns>a valid test case id or 0 if no test case was found</returns> private int getTestCaseByName(string testCaseName, int testSuiteId) { List <TestCaseId> idList = proxy.GetTestCaseIDByName(testCaseName); if (idList.Count == 0) { return(0); } foreach (TestCaseId tc in idList) { if (tc.parent_id == testSuiteId) { return(tc.id); } } return(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); } }
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); } }
public void ShouldFailBecauseOfInvalidDevKey() { proxy = new TestLink("empty", testlinkUrl); Assert.Catch <TestLinkException>(() => proxy.GetTestCaseIDByName("10 G shock")); }