示例#1
0
        private static IEnumerable <testsuiteProperty> ConvertTestsuiteProperties(ActionReport actionReport)
        {
            List <testsuiteProperty> list = new List <testsuiteProperty>();

            // action input/output parameters
            foreach (ParameterType pt in actionReport.InputParameters)
            {
                list.Add(new testsuiteProperty(Properties.Resources.PropName_Prefix_ActionInputParam + pt.NameAndType, pt.value));
            }
            foreach (ParameterType pt in actionReport.OutputParameters)
            {
                list.Add(new testsuiteProperty(Properties.Resources.PropName_Prefix_ActionInputParam + pt.NameAndType, pt.value));
            }

            // owner - iteration
            IterationReport iterationReport = actionReport.OwnerIteration;

            if (iterationReport != null)
            {
                // iteration properties
                list.AddRange(ConvertTestsuiteProperties(iterationReport));
            }

            return(list.ToArray());
        }
        private testsuitesTestsuite ConvertIterationReport(IterationReport iterationReport, int index)
        {
            // a API test iteration is converted to a JUnit testsuite
            testsuitesTestsuite ts = new testsuitesTestsuite();

            ts.id      = index - 1;               // Starts at '0' for the first testsuite and is incremented by 1 for each following testsuite
            ts.package = Input.TestAndReportName; // Derived from testsuite/@name in the non-aggregated documents

            // sample: API-00012: Iteration 1
            ts.name = string.Format("API-{0,5:00000}: {1} {2}", index, Properties.Resources.PropName_Iteration, index);

            // other JUnit required fields
            ts.timestamp = iterationReport.StartTime;
            ts.hostname  = Input.HostName;
            if (string.IsNullOrWhiteSpace(ts.hostname))
            {
                ts.hostname = "localhost";
            }
            ts.time = iterationReport.DurationSeconds;

            // properties
            ts.properties = ConvertProperties(iterationReport, index);

            // JUnit testcases
            int testcaseCount = 0;
            int failureCount  = 0;

            ts.testcase = ConvertTestcases(iterationReport, out testcaseCount, out failureCount);
            ts.tests    = testcaseCount;
            ts.failures = failureCount;

            return(ts);
        }
示例#3
0
        public static string GetBCHierarchyName(BusinessComponentReport bcReport, string split = " / ")
        {
            string hierarchyName = bcReport.Name;

            GeneralReportNode parentReport = bcReport.Owner as GeneralReportNode;

            while (parentReport != null)
            {
                string name = parentReport.Name;

                // if it is iteration, prepend "Iteration" term
                IterationReport iterationReport = parentReport as IterationReport;
                if (iterationReport != null)
                {
                    name = Properties.Resources.PropName_Iteration + iterationReport.Name;
                }

                // if it is branch, use the case name since the branch case node name is empty
                BranchReport branchReport = parentReport as BranchReport;
                if (branchReport != null)
                {
                    name = Properties.Resources.PropName_Prefix_BPTBranchCase + branchReport.CaseName;
                }

                // concat hierarchy name
                hierarchyName = name + split + hierarchyName;

                parentReport = parentReport.Owner as GeneralReportNode;
            }

            return(hierarchyName);
        }
        private testsuiteProperty[] ConvertProperties(IterationReport iterationReport, int index)
        {
            List <testsuiteProperty> list = new List <testsuiteProperty>(new testsuiteProperty[]
            {
                new testsuiteProperty(Properties.Resources.PropName_Iteration, index.ToString()),
                new testsuiteProperty(Properties.Resources.PropName_TestingTool, Input.TestingToolNameVersion),
                new testsuiteProperty(Properties.Resources.PropName_OSInfo, Input.OSInfo),
                new testsuiteProperty(Properties.Resources.PropName_Locale, Input.Locale),
                new testsuiteProperty(Properties.Resources.PropName_LoginUser, Input.LoginUser),
                new testsuiteProperty(Properties.Resources.PropName_CPUInfo, Input.CPUInfoAndCores),
                new testsuiteProperty(Properties.Resources.PropName_Memory, Input.TotalMemory)
            });

            return(list.ToArray());
        }
        public static testsuiteTestcase[] ConvertTestcases(IterationReport iterationReport, out int count, out int numOfFailures)
        {
            count         = 0;
            numOfFailures = 0;

            List <testsuiteTestcase> list = new List <testsuiteTestcase>();
            EnumerableReportNodes <ActivityReport> activities = new EnumerableReportNodes <ActivityReport>(iterationReport.AllActivitiesEnumerator);

            foreach (ActivityReport activity in activities)
            {
                list.Add(ConvertTestcase(activity, count));
                if (activity.Status == ReportStatus.Failed)
                {
                    numOfFailures++;
                }
                count++;
            }

            return(list.ToArray());
        }
示例#6
0
        private static IEnumerable <testsuiteProperty> ConvertTestsuiteProperties(IterationReport iterationReport)
        {
            List <testsuiteProperty> list = new List <testsuiteProperty>();

            // iteration index
            list.Add(new testsuiteProperty(Properties.Resources.PropName_IterationIndex, iterationReport.Index.ToString()));

            // iteration input/output parameters
            foreach (ParameterType pt in iterationReport.InputParameters)
            {
                list.Add(new testsuiteProperty(Properties.Resources.PropName_Prefix_IterationInputParam + pt.NameAndType, pt.value));
            }
            foreach (ParameterType pt in iterationReport.OutputParameters)
            {
                list.Add(new testsuiteProperty(Properties.Resources.PropName_Prefix_IterationOutputParam + pt.NameAndType, pt.value));
            }

            // iteration AUTs
            int i = 0;

            foreach (TestedApplicationType aut in iterationReport.AUTs)
            {
                i++;
                string propValue = aut.Name;
                if (!string.IsNullOrWhiteSpace(aut.Version))
                {
                    propValue += string.Format(" {0}", aut.Version);
                }
                if (!string.IsNullOrWhiteSpace(aut.Path))
                {
                    propValue += string.Format(" ({0})", aut.Path);
                }
                list.Add(new testsuiteProperty(string.Format("{0} {1}", Properties.Resources.PropName_Prefix_AUT, i), propValue));
            }

            return(list);
        }