Beispiel #1
0
        // For API test only
        private static testsuiteTestcase[] ConvertTestcases(ReportNodeCollection <XmlReport.APITest.IterationReport> iterationReports, out int count, out int numOfFailures)
        {
            count         = 0;
            numOfFailures = 0;

            List <testsuiteTestcase> list = new List <testsuiteTestcase>();

            if (iterationReports != null)
            {
                int iterationNum = 0;
                foreach (XmlReport.APITest.IterationReport iteration in iterationReports)
                {
                    iterationNum++;

                    if (iteration.AllActivitiesEnumerator != null)
                    {
                        EnumerableReportNodes <XmlReport.APITest.ActivityReport> activities = new EnumerableReportNodes <XmlReport.APITest.ActivityReport>(iteration.AllActivitiesEnumerator);
                        foreach (XmlReport.APITest.ActivityReport activity in activities)
                        {
                            testsuiteTestcase tc = APITestReportConverter.ConvertTestcase(activity, count);
                            if (tc == null)
                            {
                                continue;
                            }

                            // update activity name with the hierarchy full name
                            tc.name = string.Format("#{0,7:0000000}: {1}", count + 1, GetHierarchyFullName(activity, iterationNum));

                            list.Add(tc);
                            if (activity.Status == ReportStatus.Failed)
                            {
                                numOfFailures++;
                            }
                            count++;
                        }
                    }
                }
            }

            return(list.ToArray());
        }
Beispiel #2
0
        public static bool ConvertAndSave(CommandArguments args, TestReportBase input)
        {
            ConverterBase conv = null;

            // try to test if the input report is a GUI/API/BPT test report
            GUITestReport guiReport = input as GUITestReport;
            APITestReport apiReport = input as APITestReport;
            BPTReport     bptReport = input as BPTReport;

            if (guiReport != null)
            {
                conv = new GUITestReportConverter(args, guiReport);
            }
            else if (apiReport != null)
            {
                conv = new APITestReportConverter(args, apiReport);
            }
            else if (bptReport != null)
            {
                conv = new BPTReportConverter(args, bptReport);
            }
            else
            {
                return(false);
            }

            if (!conv.Convert())
            {
                return(false);
            }

            if (!conv.SaveFile())
            {
                return(false);
            }

            return(true);
        }