public void GetTestCasesForTestPlanTest() { Console.WriteLine(testlink.about()); var project = testlink.GetProjects().First(a => a.name == "CMGE"); var testPlan = testlink.GetProjectTestPlans(project.id).First(a => a.name == "V0-H.1020"); var platforms = testlink.GetTestPlanPlatforms(testPlan.id); Console.WriteLine($"\r\n{testPlan.name} includes platforms:"); platforms.ForEach(a => Console.WriteLine($"{a.name} (id: {a.id})")); var builds = testlink.GetBuildsForTestPlan(testPlan.id); Console.WriteLine($"\r\n{testPlan.name} includes builds:"); builds.ForEach(a => Console.WriteLine($"{a.name} (id: {a.id})")); var cases = testlink.GetTestCasesForTestPlan(testPlan.id); var testCases = cases.GroupBy(a => a.external_id).Select(g => g.First()).ToList(); Console.WriteLine($"\r\n{testPlan.name} includes test cases: {testCases.Count}"); var platformTestCases = testCases.GroupBy(a => a.platform_name); Console.WriteLine("\r\nGroups:"); var counter = 0; foreach (var group in platformTestCases) { counter += group.ToArray().Length; Console.WriteLine($"Platform: {group.Key} Test cases: {group.ToArray().Length}"); } Console.WriteLine($"All platform total test cases: {counter}"); }
public void GetTestCasesForTestPlanTest() { _testOutputHelper.WriteLine(testlink.about()); var project = testlink.GetProjects().First(a => a.name == "CMGE"); var testPlan = testlink.GetProjectTestPlans(project.id).First(a => a.name == "integration-test-plan"); _testOutputHelper.WriteLine($"test plan id: {testPlan.id}"); var platforms = testlink.GetTestPlanPlatforms(testPlan.id); _testOutputHelper.WriteLine($"\r\n{testPlan.name} includes platforms:"); platforms.ForEach(a => _testOutputHelper.WriteLine($"{a.name} (id: {a.id})")); var builds = testlink.GetBuildsForTestPlan(testPlan.id); _testOutputHelper.WriteLine($"\r\n{testPlan.name} includes builds:"); builds.ForEach(a => _testOutputHelper.WriteLine($"{a.name} (id: {a.id})")); var cases = testlink.GetTestCasesForTestPlan(testPlan.id); var testCases = cases.GroupBy(a => a.external_id).Select(g => g.First()).ToList(); _testOutputHelper.WriteLine($"\r\n{testPlan.name} includes test cases: {testCases.Count}"); testCases.ForEach(a => _testOutputHelper.WriteLine($"ID:{a.tc_id} ExternalID:{a.external_id} {a.name} {a.tester_id}")); var platformTestCases = testCases.GroupBy(a => a.platform_name); _testOutputHelper.WriteLine("\r\nGroups:"); var counter = 0; foreach (var group in platformTestCases) { counter += group.ToArray().Length; _testOutputHelper.WriteLine($"Platform: {group.Key} Test cases: {group.ToArray().Length}"); } _testOutputHelper.WriteLine($"All platform total test cases: {counter}"); }
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); } }