Index: System tests/AutomatedSystemTests/AutomatedSystemTests/AutomatedSystemTests.csproj =================================================================== diff -u -r3d784d49fb2ff11a12bcca4ffcfdcd091e65db45 -r6e2e85c0bf313ec7fb1f6d84a2185cd4320e7789 --- System tests/AutomatedSystemTests/AutomatedSystemTests/AutomatedSystemTests.csproj (.../AutomatedSystemTests.csproj) (revision 3d784d49fb2ff11a12bcca4ffcfdcd091e65db45) +++ System tests/AutomatedSystemTests/AutomatedSystemTests/AutomatedSystemTests.csproj (.../AutomatedSystemTests.csproj) (revision 6e2e85c0bf313ec7fb1f6d84a2185cd4320e7789) @@ -564,7 +564,7 @@ true d64324b9-a0a0-444a-8ca8-be84c77dacc0 - + b1dc28ee-2c35-4a85-8de5-656510b35fd9 @@ -591,7 +591,7 @@ true f0ec8e33-f569-4e1d-be5c-8be631f580cc - + b4d167ad-dc06-4869-8c29-91a1702642fb Fisheye: Tag 6e2e85c0bf313ec7fb1f6d84a2185cd4320e7789 refers to a dead (removed) revision in file `System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/SeManualFailureProbabilityFMInResultView.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/SetManualFailureProbabilityFMInResultView.cs =================================================================== diff -u --- System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/SetManualFailureProbabilityFMInResultView.cs (revision 0) +++ System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/SetManualFailureProbabilityFMInResultView.cs (revision 6e2e85c0bf313ec7fb1f6d84a2185cd4320e7789) @@ -0,0 +1,82 @@ +/* + * Created by Ranorex + * User: rodriqu_dd + * Date: 17/05/2022 + * Time: 17:35 + * + * To change this template use Tools > Options > Coding > Edit standard headers. + */ +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; +using System.Drawing; +using System.Threading; +using WinForms = System.Windows.Forms; +using Ranorex_Automation_Helpers.UserCodeCollections; +using System.Linq; +using Newtonsoft.Json; + +using Ranorex; +using Ranorex.Core; +using Ranorex.Core.Testing; + +namespace AutomatedSystemTests.Modules.ActionsDocumentView +{ + /// + /// Description of SeManualFailureProbabilityFMInResultView. + /// + [TestModule("11B4F29F-CD05-44C2-A71F-20FD99B75F3B", ModuleType.UserCode, 1)] + public class SetManualFailureProbabilityFMInResultView : ITestModule + { + + string _trajectAssessmentInformationString = ""; + [TestVariable("9779eb56-6b69-4555-8fbd-8dcb44167c7b")] + public string trajectAssessmentInformationString + { + get { return _trajectAssessmentInformationString; } + set { _trajectAssessmentInformationString = value; } + } + + + string _currentFMLabel = ""; + [TestVariable("e1a699f8-5384-403d-8cb2-e94036ed136d")] + public string currentFMLabel + { + get { return _currentFMLabel; } + set { _currentFMLabel = value; } + } + + string _ManualFailureProbToSet = ""; + [TestVariable("c37e1b0c-bde7-43d9-9a00-eac5b401cd23")] + public string ManualFailureProbToSet + { + get { return _ManualFailureProbToSet; } + set { _ManualFailureProbToSet = value; } + } + + /// + /// Constructs a new instance. + /// + public SetManualFailureProbabilityFMInResultView() + { + // Do not delete - a parameterless constructor is required! + } + + /// + /// Performs the playback of actions in this module. + /// + /// You should not call this method directly, instead pass the module + /// instance to the method + /// that will in turn invoke this method. + void ITestModule.Run() + { + var failureProbText = AutomatedSystemTestsRepository.Instance.RiskeerMainWindow.ContainerMultipleViews.DocumentViewContainer.FM_ResultView.FailureProbabilityFM.Element; + failureProbText.SetAttributeValue("AccessibleValue", ManualFailureProbToSet); + var trajectResultInformation = TrajectResultInformation.BuildAssessmenTrajectInformation(trajectAssessmentInformationString); + trajectResultInformation.ListFMsResultInformation.Where(fmItem=>fmItem.Label==currentFMLabel).FirstOrDefault().FailureProbability = ManualFailureProbToSet; + failureProbText.As().PressKeys("{Return}"); + trajectAssessmentInformationString = JsonConvert.SerializeObject(trajectResultInformation, Formatting.Indented); + } + } +} Index: System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/ValidateFailureProbabilityBasedOnIndependentSectionResultsInResultView.cs =================================================================== diff -u --- System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/ValidateFailureProbabilityBasedOnIndependentSectionResultsInResultView.cs (revision 0) +++ System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/ValidateFailureProbabilityBasedOnIndependentSectionResultsInResultView.cs (revision 6e2e85c0bf313ec7fb1f6d84a2185cd4320e7789) @@ -0,0 +1,122 @@ +/* + * Created by Ranorex + * User: rodriqu_dd + * Date: 12/05/2022 + * Time: 17:40 + * + * To change this template use Tools > Options > Coding > Edit standard headers. + */ +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; +using System.Drawing; +using System.Threading;using System.Linq; +using WinForms = System.Windows.Forms; +using Newtonsoft.Json; +using Ranorex_Automation_Helpers.UserCodeCollections; + +using Ranorex; +using Ranorex.Core; +using Ranorex.Core.Testing; + +namespace AutomatedSystemTests.Modules.ActionsDocumentView +{ + /// + /// Description of ValidateFailureProbabilityFMInResultView. + /// + [TestModule("624D9FA1-26B3-40F8-BFC7-47503BA11A9D", ModuleType.UserCode, 1)] + public class ValidateFailureProbabilityBasedOnIndependentSectionResultsInResultView : ITestModule + { + + string _labelFM = ""; + [TestVariable("d0d431e3-1478-40d4-b8fa-f84bbc8597e7")] + public string labelFM + { + get { return _labelFM; } + set { _labelFM = value; } + } + + string _trajectAssessmentInformationString = ""; + [TestVariable("83cc88df-0bcd-4b5a-99dd-5ddb8f35a27d")] + public string trajectAssessmentInformationString + { + get { return _trajectAssessmentInformationString; } + set { _trajectAssessmentInformationString = value; } + } + + /// + /// Constructs a new instance. + /// + public ValidateFailureProbabilityBasedOnIndependentSectionResultsInResultView() + { + // Do not delete - a parameterless constructor is required! + } + + /// + /// Performs the playback of actions in this module. + /// + /// You should not call this method directly, instead pass the module + /// instance to the method + /// that will in turn invoke this method. + void ITestModule.Run() + { + Mouse.DefaultMoveTime = 0; + Keyboard.DefaultKeyPressTime = 0; + Delay.SpeedFactor = 0; + var trajectResultInformation = BuildAssessmenTrajectInformation(trajectAssessmentInformationString); + var currentFMResultInformation = trajectResultInformation.ListFMsResultInformation.Where(fmItem=>fmItem.Label==labelFM).FirstOrDefault(); + var actualFailureProbFM = currentFMResultInformation.FailureProbability.ToNoGroupSeparator(); + var expectedDoubleFailureProbFM = CalculateExpectedFailureProbFM(currentFMResultInformation); + var expectedDenominatorFractionFailureProbFM = Convert.ToInt32(1.0/expectedDoubleFailureProbFM); + var expectedFailureProbFM = "1/" + expectedDenominatorFractionFailureProbFM.ToString(); + var comparison = actualFailureProbFM == expectedFailureProbFM; + + + } + + private TrajectResultInformation BuildAssessmenTrajectInformation(string trajectAssessmentInformationString) + { + TrajectResultInformation trajectAssessmentInformation; + if (trajectAssessmentInformationString=="") { + trajectAssessmentInformation = new TrajectResultInformation(); + } else { + var error = false; + trajectAssessmentInformation = JsonConvert.DeserializeObject(trajectAssessmentInformationString, new JsonSerializerSettings + { + Error = (s, e) => + { + error = true; + e.ErrorContext.Handled = true; + } + } + ); + if (error==true) { + + Report.Log(ReportLevel.Error, "error unserializing json string for trajectAssessmentInformationString: " + trajectAssessmentInformationString); + } + + } + return trajectAssessmentInformation; + } + + private double CalculateExpectedFailureProbFM(FailureMechanismResultInformation fmResultInfo) + { + return PCombin1(fmResultInfo); + } + + private double PCombin1(FailureMechanismResultInformation fmResultInfo) + { + double productInverseFailureProbability = 1.0; + foreach (var section in fmResultInfo.SectionList) { + var denominator = section.CalculationFailureProbPerSection.Substring(2).ToNoGroupSeparator(); + if (denominator!="Oneindig") { + productInverseFailureProbability = productInverseFailureProbability * (1.0 - 1.0/Double.Parse(denominator)); + } + } + double failureProbFMMech1 = 1.0-productInverseFailureProbability; + return failureProbFMMech1; + } + + } +} Fisheye: Tag 6e2e85c0bf313ec7fb1f6d84a2185cd4320e7789 refers to a dead (removed) revision in file `System tests/AutomatedSystemTests/AutomatedSystemTests/Modules/ActionsDocumentView/ValidateFailureProbabilityFMInResultView.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: System tests/AutomatedSystemTests/AutomatedSystemTests/Script22.rxtst =================================================================== diff -u -r6c6354a412f9bc5265f81196bb91df9d57c271a9 -r6e2e85c0bf313ec7fb1f6d84a2185cd4320e7789 --- System tests/AutomatedSystemTests/AutomatedSystemTests/Script22.rxtst (.../Script22.rxtst) (revision 6c6354a412f9bc5265f81196bb91df9d57c271a9) +++ System tests/AutomatedSystemTests/AutomatedSystemTests/Script22.rxtst (.../Script22.rxtst) (revision 6e2e85c0bf313ec7fb1f6d84a2185cd4320e7789) @@ -4,35 +4,14 @@ + name="ChangeFMFailureProbabilityToManual"> - - - - - - - - - - - - - - @@ -146,35 +125,14 @@ + name="ValidateFMFailureProbabilityBasedOnWorstSectionResult"> - - - - - - - - - - - - - - @@ -827,7 +785,7 @@ + name="ValidateFMFailureProbabilityBasedOnIndependentSectionResults"> @@ -925,31 +883,6 @@ type="Recording"> - - - - - - - - - - - - - - - - @@ -1015,20 +948,6 @@ id="d601846d-0fa3-4dbc-833d-8685dbcea7f2" name="OpenResultsView"> - - - - - - @@ -1325,23 +1244,15 @@ + name="ValidateFMFailureProbabilityBasedOnIndependentSectionResults"> + name="ValidateFailureProbabilityBasedOnIndependentSectionResultsInResultView"> - - - - + name="ValidateFMFailureProbabilityBasedOnWorstSectionResult"> @@ -1353,14 +1264,14 @@ + name="ChangeFMFailureProbabilityToManual"> + name="SetManualFailureProbabilityFMInResultView"> - P1FMFailureProb + FMFailureProbWorst - - P2FMFailureProb - @@ -1739,11 +1647,8 @@ newManualFMFailureProb - P1FMFailureProb + FMFailureProbWorst - - P2FMFailureProb - @@ -1759,11 +1664,11 @@ X:\script22\reference\@TR_@GF_@STPH_Oordeel_Resultaat.csv + 1/123 + 1/1234251581 - - @@ -1779,11 +1684,11 @@ X:\script22\reference\@TR_@GF_@GEKB_Oordeel_Resultaat.csv + 1/1234 + 1/43663 - - @@ -1799,12 +1704,9 @@ X:\script22\reference\@TR_@GF_@STMI_Oordeel_Resultaat.csv - 1/7654321 + 1/12345 - 1/1.111 - - 1/1.234 @@ -1822,12 +1724,9 @@ X:\script22\reference\@TR_@GF_@BSKW_Oordeel_Resultaat.csv - 1/8877665 + 1/123456 - 1/456.589 - - 1/555.555 @@ -1845,11 +1744,11 @@ X:\script22\reference\@TR_@GF_@PKW_Oordeel_Resultaat.csv + 1/1234567 + 1/888888 - - @@ -1865,12 +1764,9 @@ X:\script22\reference\@TR_@SF_Nieuw_Oordeel_Resultaat.csv - 1/7766554 + 1/12345678 - 1/96.618 - - 1/123.456 @@ -1960,9 +1856,6 @@ id="a2727582-55dc-4810-b276-f4c237c42e0b"> - -