Esempio n. 1
0
        private void CalculateTCExecutionDetails(QCTSTest tc, QCManagerReportTestCaseDetails testCaseDetails)
        {
            List <QCTSTestRun> filteredRuns = FilterRuns(tc.Runs);

            if (filteredRuns != null && filteredRuns.Count > 0)
            {
                testCaseDetails.NumberOfExecutions       = filteredRuns.Where(x => x.RunName.ToUpper().Contains("GINGER") == true).Count();
                testCaseDetails.NumberOfPassedExecutions = filteredRuns.Where(x => x.RunName.ToUpper().Contains("GINGER") == true && x.Status == "Passed").Count();

                if (testCaseDetails.NumberOfExecutions > 0)
                {
                    mExecutedNumber++;
                    mRunsNumber           += testCaseDetails.NumberOfExecutions;
                    mPassedRunsPrecentage += mRunsNumber * ((double)testCaseDetails.NumberOfPassedExecutions / (double)testCaseDetails.NumberOfExecutions);
                }
                try
                {
                    DateTime date = DateTime.Parse((filteredRuns[0].ExecutionDate));
                    testCaseDetails.LastExecutionTime = date.ToString("MM/dd/yyyy") + " " + filteredRuns[0].ExecutionTime;
                }
                catch (Exception ex)
                {
                    testCaseDetails.LastExecutionTime = (filteredRuns[0].ExecutionDate);
                    Reporter.ToLog(eAppReporterLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex);
                }
                testCaseDetails.LastExecutionStatus = filteredRuns[0].Status;
            }
            else
            {
                testCaseDetails.NumberOfExecutions       = 0;
                testCaseDetails.NumberOfPassedExecutions = 0;
                testCaseDetails.LastExecutionTime        = "NA";
                testCaseDetails.LastExecutionStatus      = "NA";
            }
        }
Esempio n. 2
0
        private void SetTestSetsData()
        {
            mQcTestCasesList.Clear();
            mTestCaseDetailsList.Clear();
            mAutomatedPrecentage  = 0;
            mExecutedNumber       = 0;
            mRunsNumber           = 0;
            mPassedRunsPrecentage = 0;
            if (mSelectQcTestSets != null && mSelectQcTestSets.Count > 0)
            {
                foreach (QCTestSetTreeItem testSetItem in mSelectQcTestSets)
                {
                    QCTestSet TS = new QCTestSet();
                    TS.TestSetID   = testSetItem.TestSetID;
                    TS.TestSetName = testSetItem.TestSetName;
                    TS.TestSetPath = testSetItem.Path;
                    TS             = ImportFromQC.ImportTestSetData(TS);//get test cases

                    foreach (QCTSTest tc in TS.Tests)
                    {
                        mQcTestCasesList.Add(tc);
                        int automatedStepsCouter = 0;
                        QCManagerReportTestCaseDetails testCaseDetails = new QCManagerReportTestCaseDetails();
                        testCaseDetails.TestSetID    = TS.TestSetID;
                        testCaseDetails.TestSetName  = TS.TestSetName;
                        testCaseDetails.TestCaseID   = tc.LinkedTestID;
                        testCaseDetails.TestCaseName = tc.TestName;

                        //check if the TC is already exist in repository
                        ActivitiesGroup repoActivsGroup = null;

                        ObservableList <ActivitiesGroup> activitiesGroup = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ActivitiesGroup>();
                        if (tc.LinkedTestID != null && tc.LinkedTestID != string.Empty)
                        {
                            repoActivsGroup = activitiesGroup.Where(x => x.ExternalID == tc.LinkedTestID).FirstOrDefault();
                        }
                        if (repoActivsGroup == null)
                        {
                            repoActivsGroup = activitiesGroup.Where(x => x.ExternalID == tc.TestID).FirstOrDefault();
                        }
                        if (repoActivsGroup != null)
                        {
                            testCaseDetails.ActivitiesGroupID   = repoActivsGroup.Guid;
                            testCaseDetails.ActivitiesGroupName = repoActivsGroup.Name;
                            //check for automation percentage
                            foreach (QCTSTestStep step in tc.Steps)
                            {
                                ObservableList <Activity> activities = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Activity>();
                                Activity repoStepActivity            = activities.Where(x => x.ExternalID == step.StepID).FirstOrDefault();
                                if (repoStepActivity != null)
                                {
                                    if (repoStepActivity.AutomationStatus == Activity.eActivityAutomationStatus.Automated)
                                    {
                                        automatedStepsCouter++;
                                    }
                                }
                            }
                        }
                        else
                        {
                            testCaseDetails.ActivitiesGroupName = "NA";
                        }
                        //set automation percentage
                        double automatedActsPrecanteg = 0;
                        if (tc.Steps.Count > 0)
                        {
                            automatedActsPrecanteg = ((double)automatedStepsCouter / (double)tc.Steps.Count);
                            mAutomatedPrecentage  += automatedActsPrecanteg;
                            automatedActsPrecanteg = Math.Floor(automatedActsPrecanteg * 100);
                            testCaseDetails.ActivitiesGroupAutomationPrecentage = automatedActsPrecanteg.ToString() + "%";
                        }
                        else
                        {
                            testCaseDetails.ActivitiesGroupAutomationPrecentage = "0%";
                        }

                        //set execution details
                        CalculateTCExecutionDetails(tc, testCaseDetails);

                        mTestCaseDetailsList.Add(testCaseDetails);
                    }
                }
            }

            //get the executers names
            var groups = mQcTestCasesList.SelectMany(x => x.Runs).GroupBy(y => y.Tester)
                         .Select(n => new
            {
                TesterName = n.Key.ToString(),
                Count      = n.Count()
            }
                                 )
                         .OrderBy(n => n.TesterName);

            ExecutionTesterFilterComboBox.SelectionChanged -= ExecutionTesterFilterComboBox_SelectionChanged;
            ExecutionTesterFilterComboBox.SelectedItem      = null;
            ExecutionTesterFilterComboBox.Items.Clear();
            ExecutionTesterFilterComboBox.Items.Add("Any");
            foreach (var v in groups)
            {
                ExecutionTesterFilterComboBox.Items.Add(v.TesterName);
            }
            ExecutionTesterFilterComboBox.SelectedValue     = "Any";
            ExecutionTesterFilterComboBox.SelectionChanged += ExecutionTesterFilterComboBox_SelectionChanged;
        }