예제 #1
0
        /// <summary>
        /// Converts the specified <see cref="ActionReport"/> to the corresponding JUnit <see cref="testsuitesTestsuite"/>.
        /// </summary>
        /// <param name="actionReport">The <see cref="ActionReport"/> instance contains the data of an action.</param>
        /// <param name="index">The index, starts from 0, to identify the order of the testsuites.</param>
        /// <returns>The converted JUnit <see cref="testsuitesTestsuite"/> instance.</returns>
        private testsuitesTestsuite ConvertTestsuite(ActionReport actionReport, int index)
        {
            // get owner iteration data
            int iterationIndex = 0;

            if (actionReport.OwnerIteration != null)
            {
                iterationIndex = actionReport.OwnerIteration.Index;
            }

            // a GUI test action is converted to a JUnit testsuite
            testsuitesTestsuite ts = new testsuitesTestsuite();

            ts.id      = index;                   // 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: GUI-00012: Iteration 1 / Action 3
            ts.name = string.Format("GUI-{0,5:00000}: {1} {2} / {3}",
                                    index + 1,
                                    Properties.Resources.PropName_Iteration,
                                    iterationIndex,
                                    actionReport.Name);

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

            // properties
            List <testsuiteProperty> properties = new List <testsuiteProperty>(ConvertTestsuiteCommonProperties(actionReport));

            properties.AddRange(ConvertTestsuiteProperties(actionReport));
            ts.properties = properties.ToArray();

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

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

            return(ts);
        }
예제 #2
0
        // For GUI / API / BPT tests
        private static void FillTestsuiteCommonData(testsuitesTestsuite ts, TestReportBase testReport, int index)
        {
            ts.id      = index; // Starts at '0' for the first testsuite and is incremented by 1 for each following testsuite
            ts.package = testReport.TestAndReportName;
            ts.name    = string.Format("TEST-{0,3:000}: {1}", index + 1, testReport.TestAndReportName);

            // other JUnit required fields
            ts.timestamp = testReport.TestRunStartTime;
            ts.hostname  = testReport.HostName;
            if (string.IsNullOrWhiteSpace(ts.hostname))
            {
                ts.hostname = "localhost";
            }
            ts.time = testReport.TestDurationSeconds;

            // properties
            List <testsuiteProperty> properties = new List <testsuiteProperty>(ConvertTestsuiteCommonProperties(testReport));

            ts.properties = properties.ToArray();
        }
예제 #3
0
        // For GUI test only
        private static testsuitesTestsuite TryConvertTestsuite(XmlReport.GUITest.TestReport testReport, int index)
        {
            if (testReport == null)
            {
                return(null);
            }

            testsuitesTestsuite ts = new testsuitesTestsuite();

            FillTestsuiteCommonData(ts, testReport, index);

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

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

            return(ts);
        }
        public override bool Convert()
        {
            bool success = true;
            int  index   = 0;
            List <testsuitesTestsuite> list = new List <testsuitesTestsuite>();

            foreach (IterationReport iterationReport in Input.Iterations)
            {
                index++;
                testsuitesTestsuite ts = ConvertIterationReport(iterationReport, index);
                if (ts != null)
                {
                    list.Add(ts);
                }
                else
                {
                    success = false;
                }
            }
            TestSuites.testsuite = list.ToArray();
            return(success);
        }
예제 #5
0
        /// <summary>
        /// Converts the specified <see cref="BusinessComponentReport"/> to the corresponding JUnit <see cref="testsuitesTestsuite"/>.
        /// </summary>
        /// <param name="bcReport">The <see cref="BusinessComponentReport"/> instance contains the data of a business component.</param>
        /// <param name="index">The index, starts from 0, to identify the order of the testsuites.</param>
        /// <returns>The converted JUnit <see cref="testsuitesTestsuite"/> instance.</returns>
        private testsuitesTestsuite ConvertTestsuite(BusinessComponentReport bcReport, int index)
        {
            // a BPT business component is converted to a JUnit testsuite
            testsuitesTestsuite ts = new testsuitesTestsuite();

            ts.id      = index;                   // 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: BC-00001: BC123 (Iteration 1 / Flow3 / Case: not match / Group1)
            ts.name = string.Format("BC-{0,5:00000}: {1}", index + 1, GetBCHierarchyName(bcReport));

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

            // properties
            List <testsuiteProperty> properties = new List <testsuiteProperty>(ConvertTestsuiteCommonProperties(bcReport));

            properties.AddRange(ConvertTestsuiteProperties(bcReport));
            ts.properties = properties.ToArray();

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

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

            return(ts);
        }