public override void visit(Generated.SubSequence obj, bool visitSubNodes)
        {
            Tests.SubSequence subSequence = (Tests.SubSequence)obj;

            if (subSequence != null)
            {
                if (subSequence.TestCases.Count == 0)
                {
                    subSequence.AddWarning("Sub sequences should hold at least one test case");
                }
                else
                {
                    Tests.TestCase testCase = (Tests.TestCase)subSequence.TestCases[0];

                    if (testCase.Steps.Count == 0)
                    {
                        testCase.AddWarning("First test case of a subsequence should hold at least one step");
                    }
                    else
                    {
                        Tests.Step step = (Tests.Step)testCase.Steps[0];

                        if (step.Name.IndexOf("Setup") < 0 && step.Name.IndexOf("Initialize") < 0)
                        {
                            step.AddWarning("First step of the first test case of a subsequence should be used to setup the system, and should hold 'Setup' or 'Initialize' in its name");
                        }
                    }
                }
            }

            base.visit(obj, visitSubNodes);
        }
Exemplo n.º 2
0
        public override Step createStep()
        {
            Step retVal = new Tests.Step();

            _defaultValueSetter.SetDefaultValue(retVal);

            return(retVal);
        }
 public override void visit(Generated.Step obj, bool visitSubNodes)
 {
     DataDictionary.Tests.Step step = (DataDictionary.Tests.Step)obj;
     if (step.getTranslationRequired() && !step.getTranslated())
     {
         step.AddInfo("Not translated step");
     }
     base.visit(obj, visitSubNodes);
 }
Exemplo n.º 4
0
            /// <summary>
            ///     Removes the actions and expectation from translated steps because they may cause conflicts.
            ///     Remove obsolete comments
            /// </summary>
            /// <param name="obj"></param>
            /// <param name="visitSubNodes"></param>
            public override void visit(Step obj, bool visitSubNodes)
            {
                Tests.Step step = (Tests.Step)obj;

                if (step.getObsoleteComment() == "")
                {
                    step.setObsoleteComment(null);
                }

                base.visit(obj, visitSubNodes);
            }
Exemplo n.º 5
0
 /// <summary>
 ///     Selects the current step by clicking on the label
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripLabel4_Click(object sender, EventArgs e)
 {
     if (EfsSystem.Runner != null)
     {
         Step step = EfsSystem.Runner.CurrentStep();
         if (step != null)
         {
             EfsSystem.Instance.Context.SelectElement(step, this, Context.SelectionCriteria.DoubleClick);
         }
     }
 }
        public Frm_ExcelImport(Step aStep)
        {
            InitializeComponent();
            excelImporter.TheStep = aStep;

            CBB_SpeedInterval.Items.Add("0.1");
            CBB_SpeedInterval.Items.Add("0.2");
            CBB_SpeedInterval.Items.Add("0.5");
            CBB_SpeedInterval.Items.Add("1.0");
            CBB_SpeedInterval.Items.Add("5.0");
            CBB_SpeedInterval.Items.Add("10.0");
        }
        /// <summary>
        /// Initializes the train parametersand the parameters required for Subset-076
        /// </summary>
        /// <param name="workbook"></param>
        /// <param name="aStep"></param>
        protected override void InitializeInput(Workbook workbook, Step aStep)
        {
            base.InitializeInput(workbook, aStep);

            // This is only relevant for Subset-076 testing
            SubStep step = new SubStep {Name = "EB release and Distance inaccuracy"};

            Worksheet aWorksheet = (Worksheet) workbook.Sheets[1];
            Range aRange = aWorksheet.UsedRange;

            AddAction(step,
                "Kernel.NationalValues.DefaultValues.PermToReleaseEmergencyBrake <- Messages.Q_NVEMRRLS.Revoke_emergency_brake_command_when_permitted_speed_supervision_limit_is_no_longer_exceeded");

            // Speed inaccuracies
            {
                if (!CurvesImporterUtils.CellIsEmpty(aRange, 8, 4))
                {
                    string inaccuracy = String.Format(CultureInfo.InvariantCulture, "{0:0.0#}",
                        (double) CurvesImporterUtils.GetCellContents(aRange, 8, 4).Value2);
                    AddAction(step, "OdometryInterface.FixedSpeedInaccuracy <- True");
                    AddAction(step, "OdometryInterface.SpeedInaccuracyCoefficient <- " + inaccuracy);
                }
                else
                {
                    AddAction(step, "OdometryInterface.FixedSpeedInaccuracy <- False");
                }
            }

            // Distance inaccuracies
            {
                // Dedfault values, just in case. They correspond to Subset-041, but should also be present in the Excel sheet
                // if Subset-041 is selected
                string inaccuracy = "5.0";
                string offset = "5.0";
                if (!CurvesImporterUtils.CellIsEmpty(aRange, 9, 4) && !CurvesImporterUtils.CellIsEmpty(aRange, 10, 4))
                {
                    offset = String.Format(CultureInfo.InvariantCulture, "{0:0.0#}",
                        (double) CurvesImporterUtils.GetCellContents(aRange, 9, 4).Value2);
                    inaccuracy = String.Format(CultureInfo.InvariantCulture, "{0:0.0#}",
                        (double) CurvesImporterUtils.GetCellContents(aRange, 10, 4).Value2);
                }
                AddAction(step, "OdometryInterface.DistanceOffset <- " + offset);
                AddAction(step, "OdometryInterface.DistanceInaccuracyCoefficient <- " + inaccuracy);
            }

            step.setSkipEngine(true);
            aStep.AddModelElement(step);
        }
Exemplo n.º 8
0
            /// <summary>
            ///     Updates the step : comment has been moved
            /// </summary>
            /// <param name="obj"></param>
            /// <param name="visitSubNodes"></param>
            public override void visit(Step obj, bool visitSubNodes)
            {
                Tests.Step step = (Tests.Step)obj;

                if (!string.IsNullOrEmpty(step.getObsoleteComment()))
                {
                    if (string.IsNullOrEmpty(step.getComment()))
                    {
                        step.setComment(step.getObsoleteComment());
                    }
                    else
                    {
                        step.setComment(step.getComment() + "\n" + step.getObsoleteComment());
                    }
                    step.setObsoleteComment(null);
                }

                base.visit(obj, visitSubNodes);
            }
        public Frm_ExcelImport(Step aStep)
        {
            InitializeComponent();
            _brakingCurvesImporter = new SetupImporter()
            {
                TheStep = aStep,
            };

            CBB_SpeedInterval.Items.Add("0.1");
            CBB_SpeedInterval.Items.Add("0.2");
            CBB_SpeedInterval.Items.Add("0.5");
            CBB_SpeedInterval.Items.Add("1.0");
            CBB_SpeedInterval.Items.Add("5.0");
            CBB_SpeedInterval.Items.Add("10.0");

            CBB_SpecialBrakeImportMode.Items.Add(XmarksActive);
            CBB_SpecialBrakeImportMode.Items.Add(XmarksInactive);
            CBB_SpecialBrakeImportMode.Text = XmarksActive;

            DisableForStepImportation();
        }
Exemplo n.º 10
0
        /// <summary>
        ///     Refreshes the display
        /// </summary>
        public override void Refresh()
        {
            if (!DoingRefresh)
            {
                try
                {
                    DoingRefresh = true;

                    string selectedFrame = frameToolStripComboBox.Text;
                    if (EfsSystem.Runner == null)
                    {
                        toolStripTimeTextBox.Text        = @"0";
                        toolStripCurrentStepTextBox.Text = Resources.Window_Refresh__none_;
                    }
                    else
                    {
                        toolStripTimeTextBox.Text = "" + EfsSystem.Runner.Time;
                        Step currentStep = EfsSystem.Runner.CurrentStep();
                        if (currentStep != null)
                        {
                            toolStripCurrentStepTextBox.Text = currentStep.Name;
                        }
                        else
                        {
                            toolStripCurrentStepTextBox.Text = Resources.Window_Refresh__none_;
                        }

                        if (EfsSystem.Runner.SubSequence != null && EfsSystem.Runner.SubSequence.Frame != null)
                        {
                            Frame         = EfsSystem.Runner.SubSequence.Frame;
                            selectedFrame = EfsSystem.Runner.SubSequence.Frame.Name;
                        }
                    }

                    testBrowserTreeView.Refresh();
                    testDescriptionTimeLineControl.Refresh();
                    testExecutionTimeLineControl.Refresh();

                    RebuildFramesComboBox();
                    frameToolStripComboBox.Text        = selectedFrame;
                    frameToolStripComboBox.ToolTipText = selectedFrame;

                    if (Frame == null || !frameToolStripComboBox.Text.Equals(Frame.Name))
                    {
                        RebuildSubSequencesComboBox();

                        if (EfsSystem.Runner != null && EfsSystem.Runner.SubSequence != null)
                        {
                            EfsSystem.Runner = null;
                        }
                    }

                    if (EfsSystem.Runner != null && EfsSystem.Runner.SubSequence != null)
                    {
                        subSequenceSelectorComboBox.Text = EfsSystem.Runner.SubSequence.Name;
                    }

                    subSequenceSelectorComboBox.ToolTipText = subSequenceSelectorComboBox.Text;
                }
                finally
                {
                    DoingRefresh = false;
                }
            }

            base.Refresh();
        }
Exemplo n.º 11
0
        /// <summary>
        ///     indicates whether a given line contains the step number provided
        /// </summary>
        /// <param name="line"></param>
        /// <param name="step"></param>
        /// <returns></returns>
        private bool stepPresent(int line, Step step, string steps)
        {
            bool retVal = false;

            if (steps.Substring(stepIndex(line, steps)).Contains("\n"))
            {
                retVal =
                    steps.Substring(stepIndex(line, steps), stepIndex(line + 1, steps) - stepIndex(line, steps))
                        .Contains(stepNumber(step));
            }
            else
            {
                retVal = steps.Substring(stepIndex(line, steps)).Contains(stepNumber(step));
            }
            return retVal;
        }
Exemplo n.º 12
0
        /// <summary>
        ///     Provides the step number, if the name of the step begins with "Step #:"
        /// </summary>
        /// <param name="step"></param>
        /// <returns></returns>
        private string stepNumber(Step step)
        {
            string retVal = "";

            if (step.Name.IndexOf(":") != -1)
            {
                retVal = step.Name.Substring(0, step.Name.IndexOf(":"));
            }

            return retVal;
        }
Exemplo n.º 13
0
        public override Step createStep()
        {
            Step retVal = new Tests.Step();

            _defaultValueSetter.SetDefaultValue(retVal);

            return retVal;
        }
        /// <summary>
        /// Creates a table for a given step of a test
        /// </summary>
        /// <param name="aStep">The step to be displayed</param>
        /// <param name="totalNumberOfRules">The total number of implemented rules in the dictionary</param>
        /// <param name="aReportConfig">The report config</param>
        /// <returns></returns>
        private void CreateStepTable(DataDictionary.Tests.Runner.Runner runner, Step aStep, int totalNumberOfRules, List<RuleCondition> activatedRules, TestsCoverageReportHandler aReportConfig)
        {
            AddParagraph(aStep.Name);

            AddTable(new string[] { "", "Statistics" }, new int[] { 40, 100 });

            double implementedPercentage = (double)((double)activatedRules.Count / (double)totalNumberOfRules) * 100;
            AddRow("Number of activated rules", String.Format("{0} ({1:0.##}%)", activatedRules.Count.ToString(), implementedPercentage));

            if (aReportConfig.AddActivatedRulesInSteps && activatedRules.Count > 0)
            {
                AddRow("Activated rules", null);
                foreach (RuleCondition ruleCondition in activatedRules)
                {
                    AppendToRow(null, ruleCondition.Name);
                }
            }
        }
        private void initializeInputForGamma(TestCase aTestCase, Workbook workbook)
        {
            Step aStep = new Step();
            aStep.Name = "Step1 - Initialize input";
            aTestCase.AddModelElement(aStep);

            /*********************************** TRAIN DATA ***********************************/
            SubStep aSubStep = new SubStep();
            aSubStep.Name = "SubStep1 - Train data";
            aSubStep.setSkipEngine(true);
            aStep.AddModelElement(aSubStep);

            /* This is a gamma train => we have to initialize brake models in the train data */
            addAction(aSubStep, String.Format("Kernel.TrainData.TrainData.Value.EBModels <- Kernel.TrainData.BrakingParameters.EBModelSet\n{{\n    ModelSet => Kernel.TrainData.BrakingParameters.BrakingModelSet{{}},\n    Kdry_rstValuesSet => Kernel.TrainData.BrakingParameters.Kdry_rstValuesSet{{}},\n    Kwet_rstValuesSet => Kernel.TrainData.BrakingParameters.Kwet_rstValuesSet{{}}\n}}"));
            addAction(aSubStep, String.Format("Kernel.TrainData.TrainData.Value.SBModels <- Kernel.TrainData.BrakingParameters.SBModelSet{{}}"));

            /* Initializing the maximum train speed */
            /* I didn't find this value in ERA sheets, but I observed than their P function can exceed 160 km/h => the maximum speed should be greater than 160 km/h */
            addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.TrainData.Value.MaximumSpeed <- {0:0.0}", 180.0));

            Worksheet aWorksheet = workbook.Sheets[1] as Worksheet;
            bool isPassengerTrain;
            importCommonTrainDataInformation(aSubStep, aWorksheet, out isPassengerTrain);

            /*********************************** TRACK DATA ***********************************/
            aSubStep = new SubStep();
            aSubStep.Name = "SubStep2 - Track data";
            aSubStep.setSkipEngine(true);
            aStep.AddModelElement(aSubStep);

            aWorksheet = workbook.Sheets[2] as Worksheet;
            importCommonTrackDataInformation(aSubStep, aWorksheet);

            /*********************************** NATIONAL VALUES ***********************************/
            aSubStep = new SubStep();
            aSubStep.Name = "SubStep3 - National values";
            aSubStep.setSkipEngine(true);
            aStep.AddModelElement(aSubStep);

            aWorksheet = workbook.Sheets[3] as Worksheet;
            importCommonNationalValuesInformation(aSubStep, aWorksheet);

            /*********************************** FIXED VALUES ***********************************/
            aSubStep = new SubStep();
            aSubStep.Name = "SubStep4 - Fixed values";
            aSubStep.setSkipEngine(true);
            aStep.AddModelElement(aSubStep);

            aWorksheet = workbook.Sheets[4] as Worksheet;
            importCommonFixedValuesInformation(aSubStep, aWorksheet);

            /****************************** BRAKE PARAMETERS (gamma) ******************************/
            aSubStep = new SubStep();
            aSubStep.Name = "SubStep5 - Brake parameters";
            aSubStep.setSkipEngine(true);
            aStep.AddModelElement(aSubStep);

            aWorksheet = workbook.Sheets[6] as Worksheet;

            importGammaBrakeParameters(aSubStep, aWorksheet, 2, 8, true);   // first combination
            importGammaBrakeParameters(aSubStep, aWorksheet, 3, 20, false);  // second combination

            /*************************** CORRECTION FACTOR KDRY_RST ***************************/
            aSubStep = new SubStep();
            aSubStep.Name = "SubStep6 - Correction factor kdry_rst";
            aSubStep.setSkipEngine(true);
            aStep.AddModelElement(aSubStep);

            aWorksheet = workbook.Sheets[7] as Worksheet;
        }
        private void fillBrakingParametersExpectations(TestCase aTestCase, int stepNumber, string name, string expression, List<double> distanceValues, List<double> speedValues, List<double> values)
        {
            Step aStep = new Step();
            aStep.Name = String.Format("Step{0} - {1}", stepNumber, name);
            aTestCase.AddModelElement(aStep);

            SubStep aSubStep = new SubStep();
            aSubStep.Name = String.Format("SubStep1 - Verify {0} values", name);
            aStep.AddModelElement(aSubStep);

            for (int i = 0; i < values.Count; i++)
            {
                if (values[i] != -1)
                {
                    Expectation expectation = new Expectation();
                    expectation.Expression = String.Format(CultureInfo.InvariantCulture, expression, Math.Round(distanceValues[i], 2), Math.Round(speedValues[i], 2), Math.Round(values[i], 4));
                    aSubStep.AddModelElement(expectation);
                }
            }
        }
        private void initializeInputForLambda(TestCase aTestCase, Workbook workbook)
        {
            Step aStep = new Step();
            aStep.Name = "Step1 - Initialize input";
            aTestCase.AddModelElement(aStep);

            /*********************************** TRAIN DATA ***********************************/
            SubStep aSubStep = new SubStep();
            aSubStep.Name = "SubStep1 - Train data";
            aSubStep.setSkipEngine(true);
            aStep.AddModelElement(aSubStep);

            /* This is a lambda train => no brake models defined in the train data */
            addAction(aSubStep, String.Format("Kernel.TrainData.TrainData.Value.EBModels <- EMPTY"));
            addAction(aSubStep, String.Format("Kernel.TrainData.TrainData.Value.SBModels <- EMPTY"));
            addAction(aSubStep, String.Format("Kernel.TrainData.TrainData.Value.NormalServiceBrakeModels <- EMPTY"));
            addAction(aSubStep, String.Format("Kernel.TrainData.TrainData.Value.T_brake_emergency <- EMPTY"));
            addAction(aSubStep, String.Format("Kernel.TrainData.TrainData.Value.T_brake_service <- EMPTY"));

            /* Initializing the maximum train speed */
            /* This value must be in the range {0km/h; 200km/h}, otherwise the conversion model will not be applicable */
            addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.TrainData.Value.MaximumSpeed <- {0:0.0}", 180.0));

            Worksheet aWorksheet = workbook.Sheets[1] as Worksheet;
            bool isPassengerTrain;
            importCommonTrainDataInformation(aSubStep, aWorksheet, out isPassengerTrain);

            /*********************************** TRACK DATA ***********************************/
            aSubStep = new SubStep();
            aSubStep.Name = "SubStep2 - Track data";
            aSubStep.setSkipEngine(true);
            aStep.AddModelElement(aSubStep);

            /* This is a lambda train => track condition brake inhibition profile is not applicable */
            addAction(aSubStep, String.Format("Kernel.TrackDescription.TrackConditions.TCProfile <- EMPTY"));

            aWorksheet = workbook.Sheets[2] as Worksheet;
            importCommonTrackDataInformation(aSubStep, aWorksheet);

            /*********************************** NATIONAL VALUES ***********************************/
            aSubStep = new SubStep();
            aSubStep.Name = "SubStep3 - National values";
            aSubStep.setSkipEngine(true);
            aStep.AddModelElement(aSubStep);

            aWorksheet = workbook.Sheets[3] as Worksheet;
            importCommonNationalValuesInformation(aSubStep, aWorksheet);

            /*********************************** FIXED VALUES ***********************************/
            aSubStep = new SubStep();
            aSubStep.Name = "SubStep4 - Fixed values";
            aSubStep.setSkipEngine(true);
            aStep.AddModelElement(aSubStep);

            aWorksheet = workbook.Sheets[4] as Worksheet;
            importCommonFixedValuesInformation(aSubStep, aWorksheet);

            /****************************** BRAKE PARAMETERS (lambda) ******************************/
            aSubStep = new SubStep();
            aSubStep.Name = "SubStep5 - Brake parameters";
            aSubStep.setSkipEngine(true);
            aStep.AddModelElement(aSubStep);

            aWorksheet = workbook.Sheets[5] as Worksheet;

            Range aRange = aWorksheet.UsedRange;
            addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.TrainData.Value.BrakePercentage <- {0:0.0#}", (double)(aRange.Cells[3, 6] as Range).Value2));

            /*************************** INTERGRATED CORRECTION FACTORS ***************************/
            aSubStep = new SubStep();
            aSubStep.Name = "SubStep6 - Integrated correction factors";
            aSubStep.setSkipEngine(true);
            aStep.AddModelElement(aSubStep);

            aWorksheet = workbook.Sheets[8] as Worksheet;

            aRange = aWorksheet.UsedRange;

            /* Initializing Kr_int */
            int index = 0;
            double doubleValue = -1;
            double temp;
            for (int i = 0; i < 9; i++)
            {
                temp = (double)(aRange.Cells[i + 32, 2] as Range).Value2;
                if (doubleValue != temp)
                {
                    double location = (double)(aRange.Cells[i + 32, 1] as Range).Value2;
                    doubleValue = temp;
                    addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKrInt.Val{0} <- Kernel.NationalValues.KrIntValue\n{{\n    LengthStep => {1:0.0},\n    Value => {2:0.0####}\n}}", index, location, doubleValue));
                    index++;
                }
            }
            addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKrInt.Val{0} <- Kernel.NationalValues.KrIntValue\n{{\n    LengthStep => Default.BaseTypes.Length.Infinity,\n    Value => {1:0.0####}\n}}", index, doubleValue));

            /* Case of a passenger train */
            if (isPassengerTrain)
            {
                /* Initializing Kv_int */
                double a = -1;
                double b = -1;
                double tempA, tempB;
                index = 0;
                for (int i = 0; i <= 9; i++)
                {
                    tempA = (double)(aRange.Cells[i + 5, 5] as Range).Value2;
                    tempB = (double)(aRange.Cells[i + 31, 5] as Range).Value2;
                    if (a != tempA || b != tempB)
                    {
                        double speed = (double)(aRange.Cells[i + 5, 4] as Range).Value2;
                        a = tempA;
                        b = tempB;
                        addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKvInt_PassengerTrain.Val{0} <- Kernel.NationalValues.KvIntValue_PassengerTrain\n{{\n    SpeedStep => {1:0.0},\n    ValueA => {2:0.0#},\n    ValueB => {3:0.0#}\n}}", index, speed, a, b));
                        index++;
                    }
                }
                addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKvInt_PassengerTrain.Val{0} <- Kernel.NationalValues.KvIntValue_PassengerTrain\n{{\n    SpeedStep => Default.BaseTypes.Speed.Infinity,\n    ValueA => {1:0.0#},\n    ValueB => {2:0.0#}\n}}", index, a, b));
            }
            else  /* Case of freight trains */
            {
                /* Initializing Kv_int */
                doubleValue = -1;
                index = 0;
                for (int i = 0; i <= 9; i++)
                {
                    temp = (double)(aRange.Cells[i + 5, 2] as Range).Value2;
                    if (doubleValue != temp)
                    {
                        double speed = (double)(aRange.Cells[i + 5, 1] as Range).Value2;
                        doubleValue = temp;
                        addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKvInt_FreightTrain.Val{0} <- Kernel.NationalValues.KvIntValue_FreightTrain\n{{\n    SpeedStep => {1:0.0},\n    Value => {2:0.0#}\n}}", index, speed, doubleValue));
                        index++;
                    }
                }
                addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKvInt_FreightTrain.Val{0} <- Kernel.NationalValues.KvIntValue_FreightTrain\n{{\n    SpeedStep => Default.BaseTypes.Speed.Infinity,\n    Value => {1:0.0#}\n}}", index, doubleValue));
            }

            /* Initializing A_NVP12 */
            addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKvInt_PassengerTrain.A_NVP12 <- {0:0.0}", (double)(aRange.Cells[44, 4] as Range).Value2));

            /* Initializing A_NVP23 */
            addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorKvInt_PassengerTrain.A_NVP23 <- {0:0.0}", (double)(aRange.Cells[44, 6] as Range).Value2));

            /* Initializing Kt_int */
            addAction(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.NationalValues.ApplicableNationalValues.Value.IntegratedCorrectionFactorForBrakeBuildUpTime <- {0:0.0}", (double)(aRange.Cells[47, 4] as Range).Value2));
        }
        private void intializeEFS(TestCase aTestCase, Workbook workbook)
        {
            Step aStep = new Step();
            aStep.Name = "Step1 - Setup";
            aTestCase.AddModelElement(aStep);

            SubStep aSubStep = new SubStep();
            aSubStep.Name = "SubStep1 - Setup";
            aSubStep.setSkipEngine(true);
            aStep.AddModelElement(aSubStep);

            TestAction levelInitialization = new TestAction();
            levelInitialization.Expression = "Kernel.Level <- Kernel.LevelData\n{\n    Value => Level.L1,\n    DataState => DataState.Valid\n}";
            aSubStep.AddModelElement(levelInitialization);

            TestAction odometryInitialization = new TestAction();
            odometryInitialization.Expression = "Odometry.NominalDistance <- 0.0";
            aSubStep.AddModelElement(odometryInitialization);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Fills the actual step with information of another test case
        /// </summary>
        /// <param name="oldTestCase"></param>
        public void Merge(Step aStep)
        {
            setAllSubSteps(aStep.SubSteps);

            setComment(aStep.Comment);
            setTranslated(aStep.getTranslated());
            setTranslationRequired(aStep.getTranslationRequired());
        }
        private void verifyInputForLambda(TestCase aTestCase, Workbook workbook)
        {
            Step aStep = new Step();
            aStep.Name = "Step1 - Verify input";
            aTestCase.AddModelElement(aStep);

            /*********************************** TRAIN DATA ***********************************/
            SubStep aSubStep = new SubStep();
            aSubStep.Name = "SubStep1 - Train data";
            aStep.AddModelElement(aSubStep);

            addAction(aSubStep, "Kernel.TrainData.BrakingParameters.ConversionModel.Initialize()");
            addAction(aSubStep, "Kernel.SpeedAndDistanceMonitoring.ReleaseSpeedSupervision.UpdateReleaseSpeed()");
            addExpectation(aSubStep, "Kernel.TrainData.BrakingParameters.ConversionModel.ConversionModelIsUsed() == True");

            /********************************* BRAKE PARAMETERS *********************************/
            aSubStep = new SubStep();
            aSubStep.Name = "SubStep2 - Brake parameters";
            aStep.AddModelElement(aSubStep);

            Worksheet aWorksheet = workbook.Sheets[5] as Worksheet;

            Range aRange = aWorksheet.UsedRange;

            addAction(aSubStep, "Kernel.SpeedAndDistanceMonitoring.TargetSupervision.InitializeTimeIntervals()");

            /* Verifying kto */
            addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.BrakingParameters.ConversionModel.kto() == {0:0.0#}", (double)(aRange.Cells[7, 6] as Range).Value2));

            if (TargetSpeed == 0)  /* In this case, the values of T_brake_emergency_cmt and T_brake_service_cmt do not make sense (3.13.3.4.4.1) */
            {
                /* Verifying T_brake_emergency_cm0 */
                addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.BrakingParameters.ConversionModel.T_brake_emergency_cm0 == {0:0.0#}", (double)(aRange.Cells[8, 6] as Range).Value2));

                /* Verifying T_brake_service_cm0 */
                addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.BrakingParameters.ConversionModel.T_brake_service_cm0 == {0:0.0#}", (double)(aRange.Cells[10, 6] as Range).Value2));
            }
            else   /* In this case, the values of T_brake_emergency_cm0 and T_brake_service_cm0 do not make sense (3.13.3.4.4.1) */
            {
                /* Verifying T_brake_emergency_cmt */
                addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.BrakingParameters.ConversionModel.T_brake_emergency_cmt == {0:0.0#}", (double)(aRange.Cells[9, 6] as Range).Value2));

                /* Verifying T_brake_service_cmt */
                addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.BrakingParameters.ConversionModel.T_brake_service_cmt == {0:0.0#}", (double)(aRange.Cells[11, 6] as Range).Value2));
            }

            /* Verifying T_be */
            addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.BrakingParameters.T_be() == {0:0.0#}", (double)(aRange.Cells[12, 6] as Range).Value2));

            /* Verifying T_bs */
            addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "Kernel.TrainData.BrakingParameters.T_bs() == {0:0.0#}", (double)(aRange.Cells[13, 6] as Range).Value2));

            /********************* BRAKE PARAMETERS (A_brake_emergency) *********************/
            aSubStep = new SubStep();
            aSubStep.Name = "SubStep3 - Brake parameters (A_brake_emergency)";
            aStep.AddModelElement(aSubStep);

            /* Verifying A_brake_emergency */
            double doubleValue = -1;
            double temp;
            for (int i = 16; i <= 27; i++)
            {
                temp = (double)(aRange.Cells[i, 10] as Range).Value2;
                if (doubleValue != temp)
                {
                    if (doubleValue != -1)
                    {
                        addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "ERA_BrakingCurvesVerification.Compare\n(\n    Val1 => Kernel.TrainData.BrakingParameters.ConversionModel.A_brake_emergency(V => {0:0.0########}),\n    Val2 => {1:0.0########}\n)", (double)(aRange.Cells[i, 9] as Range).Value2 - 0.000000001, doubleValue));
                    }
                    doubleValue = temp;
                    double speedValue = (double)(aRange.Cells[i, 9] as Range).Value2;
                    if (Math.Abs(speedValue - Math.Round(speedValue, 8)) > 0)
                    {
                        speedValue += 0.000000001;
                    }
                    addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "ERA_BrakingCurvesVerification.Compare\n(\n    Val1 => Kernel.TrainData.BrakingParameters.ConversionModel.A_brake_emergency(V => {0:0.0########}),\n    Val2 => {1:0.0########}\n)", speedValue, doubleValue));
                }
            }

            /* Verifying V_lim EBI */
            addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "ERA_BrakingCurvesVerification.Compare\n(\n    Val1 => Kernel.TrainData.BrakingParameters.ConversionModel.A_brake_emergency.Val1.SpeedStep,\n    Val2 => {0:0.0########}\n)", (double)(aRange.Cells[17, 9] as Range).Value2));

            /*********************** BRAKE PARAMETERS (A_brake_service) ***********************/
            aSubStep = new SubStep();
            aSubStep.Name = "SubStep4 - Brake parameters (A_brake_service)";
            aStep.AddModelElement(aSubStep);

            /* Verifying A_brake_service */
            doubleValue = -1;
            for (int i = 16; i <= 27; i++)
            {
                temp = (double)(aRange.Cells[i, 14] as Range).Value2;
                if (doubleValue != temp)
                {
                    if (doubleValue != -1)
                    {
                        addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "ERA_BrakingCurvesVerification.Compare\n(\n    Val1 => Kernel.TrainData.BrakingParameters.ConversionModel.A_brake_service(V => {0:0.0########}),\n    Val2 => {1:0.0########}\n)", (double)(aRange.Cells[i, 13] as Range).Value2 - 0.000000001, doubleValue));
                    }
                    doubleValue = temp;
                    double speedValue = (double)(aRange.Cells[i, 13] as Range).Value2;
                    if (Math.Abs(speedValue - Math.Round(speedValue, 8)) > 0)
                    {
                        speedValue += 0.000000001;
                    }
                    addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "ERA_BrakingCurvesVerification.Compare\n(\n    Val1 => Kernel.TrainData.BrakingParameters.ConversionModel.A_brake_service(V => {0:0.0########}),\n    Val2 => {1:0.0########}\n)", speedValue, doubleValue));
                }
            }

            /* Verifying V_lim BS */
            addExpectation(aSubStep, String.Format(CultureInfo.InvariantCulture, "ERA_BrakingCurvesVerification.Compare\n(\n    Val1 => Kernel.TrainData.BrakingParameters.ConversionModel.A_brake_service.Val1.SpeedStep,\n    Val2 => {0:0.0########}\n)", (double)(aRange.Cells[17, 13] as Range).Value2));
        }
        private void verifyInputForGamma(TestCase aTestCase, Workbook workbook)
        {
            Step aStep = new Step();
            aStep.Name = "Step1 - Verify input";
            aTestCase.AddModelElement(aStep);

            /*********************************** TRAIN DATA ***********************************/
            SubStep aSubStep = new SubStep();
            aSubStep.Name = "SubStep1 - Train data";
            aStep.AddModelElement(aSubStep);

            addAction(aSubStep, "Kernel.SpeedAndDistanceMonitoring.ReleaseSpeedSupervision.UpdateReleaseSpeed()");
            addExpectation(aSubStep, "Kernel.TrainData.BrakingParameters.ConversionModel.ConversionModelIsUsed() == False");
        }
 /// <summary>
 /// Creates a new step
 /// </summary>
 /// <param name="step"></param>
 public StepTreeNode createStep(DataDictionary.Tests.Step step)
 {
     return(steps.createStep(step));
 }
        /// <summary>
        ///     Creates a section for a given step
        /// </summary>
        /// <param name="aStep">The step to be displayed</param>
        /// <param name="activatedRules">The list of rules activated by this step</param>
        /// <param name="aReportConfig">The report config</param>
        private void CreateStepSection(Step aStep, List<RuleCondition> activatedRules,
            TestsCoverageReportHandler aReportConfig)
        {
            string title = "Step " + aStep.Name;
            AddSubParagraph(title);

            CreateActivatedRulesSection("",
                new HashSet<RuleCondition>(activatedRules),
                aReportConfig.Dictionary.ImplementedRules,
                aReportConfig.AddActivatedRulesInTestCases);

            CloseSubParagraph();
        }