예제 #1
0
 public OperationUpdateEventArgs(OperationStatus status, double?progressPercent, double?recentResult, long?elapsedMs, ResultsReport results)
 {
     Results         = results;
     ProgressPercent = progressPercent;
     RecentResult    = recentResult;
     ElapsedMs       = elapsedMs;
     Status          = status;
 }
 /* gets test objects from xml report*/
 protected override List <XElement> GetTestObjectResults()
 {
     return(ResultsReport.Descendants("tessyobject").Where(x => x.Attribute("type").Value == "module").ToList());
 }
        /* fills summary of the module (e.g number of scenarios, reached function coverage)
         * and generates scenario models using integration test results for every created scenario */
        protected sealed override void FillTestObjectResults(IntegrationModule moduleToFillResults)
        {
            /* get summary of the module */
            moduleToFillResults.TotalNumberOfTestcases       = int.Parse(ResultsReport.Descendants("statistic").FirstOrDefault().Attribute("total").Value);
            moduleToFillResults.NumberOfSuccessfulTestcases  = int.Parse(ResultsReport.Descendants("statistic").FirstOrDefault().Attribute("ok").Value);
            moduleToFillResults.NumberOfFailedTestcases      = int.Parse(ResultsReport.Descendants("statistic").FirstOrDefault().Attribute("notok").Value);
            moduleToFillResults.NumberOfNotExecutedTestcases = int.Parse(ResultsReport.Descendants("statistic").FirstOrDefault().Attribute("notexecuted").Value);

            try
            {
                moduleToFillResults.ValueOfFunctionCoverage = Convert.ToDouble(ResultsReport.Descendants("fc").FirstOrDefault().Attribute("percentage").Value, CultureInfo.InvariantCulture);
            }
            catch (Exception e)
            {
                MessageBox.Show($"Warning: FC data of module {moduleToFillResults.Name} is not available. Tests may be not executed.\n {e}");
            }

            /* flags for correct evaluation of test verdict */
            bool fcVerdict         = false;
            bool functionalVerdict = false;

            /* if function coverage is o.k.*/
            if (moduleToFillResults.ValueOfFunctionCoverage.Equals(100))
            {
                /* set flag */
                fcVerdict = true;
            }
            /* if every scenario is "green" */
            if (moduleToFillResults.TotalNumberOfTestcases.Equals(moduleToFillResults.NumberOfSuccessfulTestcases))
            {
                /* set flag */
                functionalVerdict = true;
            }
            /* if both of flags are set - assign o.k. verdict value */
            if (fcVerdict.Equals(true) && functionalVerdict.Equals(true))
            {
                moduleToFillResults.Verdict = _Settings.container.OkVerdictValue;
            }
            else /* set n.o.k. otherwise*/
            {
                moduleToFillResults.Verdict = _Settings.container.NokVerdictValue;
            }

            /* list of scenario results*/
            List <Scenario> scenarios = new List <Scenario>();

            /* for every scenario */
            foreach (var scenario in TestObjectResults)
            {
                /* get its name */
                string name          = scenario.Attribute("name").Value;
                string specification = string.Empty;
                string verdict       = string.Empty;

                try /* try to read scenario specification */
                {
                    specification = scenario.Attribute("specification").Value;
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"Warning: Scenario {scenario.Name} has no filled specification in Tessy tests\n {ex}");
                }

                /* evaluate verdict of scenario */
                if (scenario.Attribute("success").Value.Equals("ok"))
                {
                    verdict = _Settings.container.OkVerdictValue;
                }
                else if (scenario.Attribute("success").Value.Equals("nok"))
                {
                    verdict = _Settings.container.NokVerdictValue;
                }
                else
                {
                    verdict = _Settings.container.NotTestedVerdictValue;
                }

                /* add new scenario to list */
                scenarios.Add(new Scenario(name, specification, verdict));
            }

            /* assign scenarios to module */
            moduleToFillResults.Scenarios = scenarios;
        }
 /* gets scenarios from test report */
 protected override List <XElement> GetTestObjectResults()
 {
     return(ResultsReport.Descendants("testcase").ToList());
 }