Exemple #1
0
        private static testsuiteTestcase ConvertTestcase(CheckpointReport checkpointReport, int index)
        {
            if (checkpointReport == null || string.IsNullOrWhiteSpace(checkpointReport.CheckpointType))
            {
                // not a checkpoint or checkpoint type is empty - ignore
                return(null);
            }

            // sample: Standard Checkpoint (DB Checkpoint) - "checkpoint 1"
            string checkpointDisplayName = checkpointReport.CheckpointType;

            if (!string.IsNullOrWhiteSpace(checkpointReport.CheckpointSubType))
            {
                checkpointDisplayName += string.Format(" ({0})", checkpointReport.CheckpointSubType);
            }
            checkpointDisplayName += " - " + checkpointReport.Name;

            testsuiteTestcase tc = new testsuiteTestcase();

            tc.name      = string.Format("#{0,5:00000}: {1}", index + 1, checkpointDisplayName);
            tc.classname = checkpointReport.StepReport.TestObjectPath;
            tc.time      = checkpointReport.StepReport.DurationSeconds;

            if (checkpointReport.Status == ReportStatus.Failed)
            {
                testsuiteTestcaseFailure failure = new testsuiteTestcaseFailure();
                failure.message = checkpointReport.FailedDescription;
                failure.type    = string.Empty;
                tc.Item         = failure;
            }

            return(tc);
        }
Exemple #2
0
        /// <summary>
        /// Converts the specified <see cref="StepReport"/> to the corresponding JUnit <see cref="testsuiteTestcase"/>.
        /// </summary>
        /// <param name="stepReport">The <see cref="StepReport"/> instance contains the data of a GUI test step.</param>
        /// <param name="index">The index, starts from 0, to identify the order of the testcases.</param>
        /// <returns>The converted JUnit <see cref="testsuiteTestcase"/> instance.</returns>
        public static testsuiteTestcase ConvertTestcase(StepReport stepReport, int index)
        {
            // the step might be a checkpoint
            CheckpointReport checkpointReport = CheckpointReport.FromStepReport(stepReport);

            if (checkpointReport != null)
            {
                return(ConvertTestcase(checkpointReport, index));
            }

            // a step with smart identification?
            if (stepReport.SmartIdentification != null)
            {
                return(ConvertTestcaseWithSmartIdentificationInfo(stepReport, index));
            }

            // a general step
            testsuiteTestcase tc = new testsuiteTestcase();

            tc.name      = string.Format("#{0,5:00000}: {1}", index + 1, stepReport.Name);
            tc.classname = stepReport.TestObjectPath;
            tc.time      = stepReport.DurationSeconds;

            if (stepReport.Status == ReportStatus.Failed)
            {
                testsuiteTestcaseFailure failure = new testsuiteTestcaseFailure();
                failure.message = stepReport.ErrorText;
                failure.type    = string.Empty;
                tc.Item         = failure;
            }

            return(tc);
        }
        public static testsuiteTestcase ConvertTestcase(ActivityReport activityReport, int index)
        {
            testsuiteTestcase tc = new testsuiteTestcase();

            tc.name = string.Format("#{0,5:00000}: {1}", index + 1, activityReport.Name);
            if (activityReport.ActivityExtensionData != null && activityReport.ActivityExtensionData.VTDType != null)
            {
                tc.classname = activityReport.ActivityExtensionData.VTDType.Value;
            }
            tc.time = activityReport.DurationSeconds;

            if (activityReport.Status == ReportStatus.Failed)
            {
                testsuiteTestcaseFailure failure = new testsuiteTestcaseFailure();

                if (activityReport.CheckpointData != null && activityReport.CheckpointData.Checkpoints != null)
                {
                    StringBuilder sb = new StringBuilder();
                    foreach (ExtData data in activityReport.CheckpointData.Checkpoints)
                    {
                        if (data.KnownVTDStatus == VTDStatus.Failure)
                        {
                            string actualValue   = data.VTDActual != null ? data.VTDActual.Value : string.Empty;
                            string expectedValue = data.VTDExpected != null ? data.VTDExpected.Value : string.Empty;
                            string operation     = data.VTDOperation != null ? data.VTDOperation.Value : string.Empty;
                            if (string.IsNullOrEmpty(actualValue) && string.IsNullOrEmpty(expectedValue) && !string.IsNullOrEmpty(operation))
                            {
                                // sample: [Checkpoint 1] Arguments[1]: Array - Fixed (compound)
                                sb.AppendFormat(Properties.Resources.APITest_Checkpoint_CompoundValue,
                                                data.VTDName != null ? data.VTDName.Value : string.Empty,
                                                data.VTDXPath != null ? data.VTDXPath.Value : string.Empty,
                                                !string.IsNullOrEmpty(operation) ? operation : Properties.Resources.APITest_Checkpoint_NoOperation);
                            }
                            else
                            {
                                // sample: [Checkpoint 2] StatusCode: 404 (actual)  =  200 (expected)
                                sb.AppendFormat(Properties.Resources.APITest_Checkpoint_ActExp,
                                                data.VTDName != null ? data.VTDName.Value : string.Empty,
                                                data.VTDXPath != null ? data.VTDXPath.Value : string.Empty,
                                                !string.IsNullOrEmpty(actualValue) ? actualValue : Properties.Resources.APITest_Checkpoint_EmptyValue,
                                                !string.IsNullOrEmpty(operation) ? operation : Properties.Resources.APITest_Checkpoint_NoOperation,
                                                !string.IsNullOrEmpty(expectedValue) ? expectedValue : Properties.Resources.APITest_Checkpoint_EmptyValue);
                            }
                            sb.AppendLine();
                        }
                    }
                    failure.message = sb.ToString();
                }

                if (string.IsNullOrWhiteSpace(failure.message))
                {
                    failure.message = activityReport.Description;
                }
                failure.type = string.Empty;
                tc.Item      = failure;
            }

            return(tc);
        }
Exemple #4
0
        /// <summary>
        /// Converts the specified <see cref="BCStepReport"/> to the corresponding JUnit <see cref="testsuiteTestcase"/>.
        /// </summary>
        /// <param name="stepReport">The <see cref="BCStepReport"/> instance contains the data of a BPT business component step.</param>
        /// <param name="index">The index, starts from 0, to identify the order of the testcases.</param>
        /// <returns>The converted JUnit <see cref="testsuiteTestcase"/> instance.</returns>
        public static testsuiteTestcase ConvertTestcase(BCStepReport stepReport, int index)
        {
            testsuiteTestcase tc = new testsuiteTestcase();

            tc.name      = string.Format("#{0,5:00000}: {1}", index + 1, stepReport.Name);
            tc.classname = stepReport.TestObjectPath;
            tc.time      = stepReport.DurationSeconds;

            if (stepReport.Status == ReportStatus.Failed)
            {
                testsuiteTestcaseFailure failure = new testsuiteTestcaseFailure();
                failure.message = stepReport.ErrorText;
                failure.type    = string.Empty;
                tc.Item         = failure;
            }

            return(tc);
        }