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}");
        }
Exemple #2
0
        public int GetInternalTestCaseID(String testCaseExternalId)
        {
            int testCaseId = 0;

            for (int index = 0; index < testLink.GetTestCasesForTestPlan(_testPlanId).Count; index++)
            {
                String externalID = testLink.GetTestCasesForTestPlan(_testPlanId)[index].external_id;

                if (externalID.Equals(testCaseExternalId))
                {
                    testCaseId = testLink.GetTestCasesForTestPlan(_testPlanId)[index].tc_id;
                }
            }

            return(testCaseId);
        }
        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}");
        }
Exemple #4
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);
            }
        }