Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public void CheckpointReport_CanBeCreated()
        {
            //Given
            CheckpointReport checkpointReport;

            //When
            checkpointReport = new CheckpointReport();

            //Then
            Assert.NotNull(checkpointReport);
        }
Ejemplo n.º 4
0
 public void DriverReportedOffTrack(Transponder transponder, InfractionSeverityIdentifier infractionSeverity) => CheckpointReport?.Invoke(this, transponder, infractionSeverity);