ProductionUiCordonel.UnitTests: - reworked - UNFINISHED

This commit is contained in:
Thomas Wiedebusch
2025-11-22 11:36:08 +01:00
parent 677fb1cf3d
commit 1bd560de9d
5 changed files with 61 additions and 41 deletions
@@ -466,7 +466,7 @@ Then Check the generic test results
# ================================================================================================================================ # ================================================================================================================================
@CheckProductionStateProcess @CheckProductionStateProcess
Scenario: [SRS_TBF_EOL_PP_CHECK_PROD_STATE_016]_Check_Complete_Flow_Production_State Scenario: [SRS_TBF_EOL_PP_CHECK_PROD_STATE_017]_Check_Complete_Flow_Production_State
FUNCTION: Check the entire production process sequence except the database calls with all underlaying sub-processes. FUNCTION: Check the entire production process sequence except the database calls with all underlaying sub-processes.
PRESETS: Preset all values with valid parameters to pass the test as "Okay" needed to successfully pass all underlaying tests: PRESETS: Preset all values with valid parameters to pass the test as "Okay" needed to successfully pass all underlaying tests:
- EOL Id | EOL StartDate | Cordonel PcbId | EOL PcbId - EOL Id | EOL StartDate | Cordonel PcbId | EOL PcbId
@@ -1897,14 +1897,14 @@ testRunner.Then("Check the generic test results", ((string)(null)), ((TechTalk.S
} }
[NUnit.Framework.TestAttribute()] [NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("[SRS_TBF_EOL_PP_CHECK_PROD_STATE_016]_Check_Complete_Flow_Production_State")] [NUnit.Framework.DescriptionAttribute("[SRS_TBF_EOL_PP_CHECK_PROD_STATE_017]_Check_Complete_Flow_Production_State")]
[NUnit.Framework.CategoryAttribute("CheckProductionStateProcess")] [NUnit.Framework.CategoryAttribute("CheckProductionStateProcess")]
public virtual void SRS_TBF_EOL_PP_CHECK_PROD_STATE_016_Check_Complete_Flow_Production_State() public virtual void SRS_TBF_EOL_PP_CHECK_PROD_STATE_017_Check_Complete_Flow_Production_State()
{ {
string[] tagsOfScenario = new string[] { string[] tagsOfScenario = new string[] {
"CheckProductionStateProcess"}; "CheckProductionStateProcess"};
System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary();
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("[SRS_TBF_EOL_PP_CHECK_PROD_STATE_016]_Check_Complete_Flow_Production_State", "FUNCTION: Check the entire production process sequence except the database calls " + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("[SRS_TBF_EOL_PP_CHECK_PROD_STATE_017]_Check_Complete_Flow_Production_State", "FUNCTION: Check the entire production process sequence except the database calls " +
"with all underlaying sub-processes. \r\nPRESETS: Preset all values with valid par" + "with all underlaying sub-processes. \r\nPRESETS: Preset all values with valid par" +
"ameters to pass the test as \"Okay\" needed to successfully pass all underlaying t" + "ameters to pass the test as \"Okay\" needed to successfully pass all underlaying t" +
"ests:\r\n - EOL Id | EOL StartDate | Cordonel PcbId | EOL PcbId\r\n " + "ests:\r\n - EOL Id | EOL StartDate | Cordonel PcbId | EOL PcbId\r\n " +
@@ -256,7 +256,10 @@ namespace Xylem.Common.Production.ProductionUiCordonel.UnitTests.Steps
/// Presets needed to pass preceding tests or initialize some properties to a defined state /// Presets needed to pass preceding tests or initialize some properties to a defined state
/// </summary> /// </summary>
private String _presetTestCaseJson = ""; private String _presetTestCaseJson = "";
private TestRequirement _presets; /// <summary>
/// Presets needed to pass preceding tests or initialize some properties to a defined state
/// </summary>
private TestRequirement _presetTestCase;
#endregion ----------------------------- Production State Properties ------------------------------------------ #endregion ----------------------------- Production State Properties ------------------------------------------
@@ -868,55 +871,52 @@ namespace Xylem.Common.Production.ProductionUiCordonel.UnitTests.Steps
/// <remarks date="2024-Dec-10" author="Thomas Wiedebusch"> /// <remarks date="2024-Dec-10" author="Thomas Wiedebusch">
/// - Login to build App list and registers. /// - Login to build App list and registers.
/// </remarks> /// </remarks>
/// <remarks date="2025-Nov-21" author="Thomas Wiedebusch">
/// - New object with deep copy of presetTestCase using the Json serializer.
/// </remarks>
/// <remarks date="2025-Nov-22" author="Thomas Wiedebusch">
/// - Moved meter login for new test requirement and register restorers modification to
/// <see cref="NewTestRequirement"/>.
/// </remarks>
private void ReadTestTable(Table table) private void ReadTestTable(Table table)
{ {
// Generate list of tests out of the "Given" table and create test-cases // Generate list of tests out of the "Given" table and create test-cases
foreach (var row in table.Rows) foreach (var row in table.Rows)
{ {
//var testCase = NewTestRequirement();
//// Check if presets are required, if so copy all properties
//if (_presets.Meter != null)
//{
// ClassAccess.CopyAllProperties(testCase.Meter, _presets.Meter);
// ClassAccess.CopyAllProperties(testCase.ProductionRequirements, _presets.ProductionRequirements);
// ClassAccess.CopyAllProperties(testCase.RequiredEOLProgress, _presets.RequiredEOLProgress);
// ClassAccess.CopyAllProperties(testCase.CalibCheckRegisterRestorer,
// _presets.CalibCheckRegisterRestorer);
// ClassAccess.CopyAllProperties(testCase.RegisterRestorer, _presets.RegisterRestorer);
// ClassAccess.CopyAllProperties(testCase.CordonelDeviceStatus, _presets.CordonelDeviceStatus);
// testCase.FwUpdatePackage.AddRange(_presets.FwUpdatePackage);
// testCase.TestBenchState.AddRange(_presets.TestBenchState);
//}
TestRequirement testCase; TestRequirement testCase;
// Check if presets are required, if so copy all properties using the Json.Deserializer to create a // Check if presets are required, if so copy all properties using the Json.Deserializer to create a
// new object!!! // new object as deep copy!!!
if (_presets.Meter != null) if (_presetTestCase.Meter != null)
{ {
if (string.IsNullOrEmpty(_presetTestCaseJson)) if (string.IsNullOrEmpty(_presetTestCaseJson))
{ {
_presetTestCaseJson = JsonConvert.SerializeObject(_presets); _presetTestCaseJson = JsonConvert.SerializeObject(_presetTestCase);
} }
// Create a new object with a deep copy of the _presetTestCase
testCase = JsonConvert.DeserializeObject<TestRequirement>(_presetTestCaseJson); testCase = JsonConvert.DeserializeObject<TestRequirement>(_presetTestCaseJson);
//if (testCase.Meter == null)
//{ // Special meter properties which are not include in the deep copy
// testCase.Meter = new MockGenesis(); ClassAccess.CopyAllProperties(testCase.Meter, _presetTestCase.Meter);
//}
// Login is needed for building the MeterAppListVersion and generating the accessible register list.
// This register list will be used to check for valid ranges.
testCase.Meter?.Login();
} }
// Preset is not required, a single testCase has to be created
else else
{ {
testCase = NewTestRequirement(); testCase = NewTestRequirement();
} }
// Enable register compare even if not physically read from meter //// Enable register compare even if not physically read from meter
testCase.RegisterRestorer.RenewMeter(testCase.Meter); //testCase.RegisterRestorer.RenewMeter(testCase.Meter);
testCase.RegisterRestorer.EnableCompareExternalSetRegisters(); //testCase.RegisterRestorer.EnableCompareExternalSetRegisters();
testCase.CalibCheckRegisterRestorer.RenewMeter(testCase.Meter); //testCase.CalibCheckRegisterRestorer.RenewMeter(testCase.Meter);
testCase.CalibCheckRegisterRestorer.EnableCompareExternalSetRegisters(); //testCase.CalibCheckRegisterRestorer.EnableCompareExternalSetRegisters();
// Login is needed for building the MeterAppListVersion and generating the accessible register list. //// Login is needed for building the MeterAppListVersion and generating the accessible register list.
// This register list will be used to check for valid ranges. //// This register list will be used to check for valid ranges.
testCase.Meter?.Login(); //testCase.Meter?.Login();
// This is the multiple row test table defining individual test cases // This is the multiple row test table defining individual test cases
ReadTable(row, ref testCase); ReadTable(row, ref testCase);
@@ -936,20 +936,23 @@ namespace Xylem.Common.Production.ProductionUiCordonel.UnitTests.Steps
/// <remarks date="2024-Dec-10" author="Thomas Wiedebusch"> /// <remarks date="2024-Dec-10" author="Thomas Wiedebusch">
/// - Login to build App list and registers. /// - Login to build App list and registers.
/// </remarks> /// </remarks>
/// <remarks date="2025-Nov-22" author="Thomas Wiedebusch">
/// - Moved meter login to <see cref="NewTestRequirement"/>.
/// </remarks>
private void ReadPresetTable(Table table) private void ReadPresetTable(Table table)
{ {
if (_presets.Meter == null) if (_presetTestCase.Meter == null)
{ {
_presets = NewTestRequirement(); _presetTestCase = NewTestRequirement();
} }
// Login is needed for building the MeterAppListVersion and generating the accessible register list. //// Login is needed for building the MeterAppListVersion and generating the accessible register list.
// This register list will be used to check for valid ranges. //// This register list will be used to check for valid ranges.
_presets.Meter?.Login(); //_presetTestCase.Meter?.Login();
// A preset table is limited to exclusively one row, those settings will be used for every test of the // A preset table is limited to exclusively one row, those settings will be used for every test of the
// test-cases! // test-cases!
ReadTable(table.Rows[0], ref _presets); ReadTable(table.Rows[0], ref _presetTestCase);
} }
/// <summary> /// <summary>
@@ -1755,6 +1758,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.UnitTests.Steps
/// <remarks date="2024-Nov-19" author="Thomas Wiedebusch"> /// <remarks date="2024-Nov-19" author="Thomas Wiedebusch">
/// - Initial. /// - Initial.
/// </remarks> /// </remarks>
/// <remarks date="2025-Nov-22" author="Thomas Wiedebusch">
/// - Init meter and enable change of values for register restorers.
/// </remarks>
private static TestRequirement NewTestRequirement() private static TestRequirement NewTestRequirement()
{ {
var testCase = new TestRequirement var testCase = new TestRequirement
@@ -1772,6 +1778,13 @@ namespace Xylem.Common.Production.ProductionUiCordonel.UnitTests.Steps
}; };
testCase.RegisterRestorer = new RegisterRestorer(testCase.Meter); testCase.RegisterRestorer = new RegisterRestorer(testCase.Meter);
testCase.CalibCheckRegisterRestorer = new RegisterRestorer(testCase.Meter); testCase.CalibCheckRegisterRestorer = new RegisterRestorer(testCase.Meter);
// Enable register compare even if not physically read from meter
testCase.RegisterRestorer.EnableCompareExternalSetRegisters();
testCase.CalibCheckRegisterRestorer.EnableCompareExternalSetRegisters();
// Login is needed for building the MeterAppListVersion and generating the accessible register list.
// This register list will be used to check for valid ranges.
testCase.Meter?.Login();
return testCase; return testCase;
} }
@@ -277,6 +277,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
/// be completed as the PcbId and the order number is needed. /// be completed as the PcbId and the order number is needed.
/// Checks: /// Checks:
/// - Requirements are collected, /// - Requirements are collected,
/// - Validate CSD,
/// - EOL progress for Sentinel can be generated, /// - EOL progress for Sentinel can be generated,
/// - PcbId, /// - PcbId,
/// - Region, /// - Region,
@@ -332,6 +333,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
/// <remarks date="2025-Mai-28" author="Thomas Wiedebusch"> /// <remarks date="2025-Mai-28" author="Thomas Wiedebusch">
/// - Check radio signal levels in parameter list. /// - Check radio signal levels in parameter list.
/// </remarks> /// </remarks>
/// <remarks date="2025-Nov-21" author="Thomas Wiedebusch">
/// - Validate CSD.
/// </remarks>
public override StatusReturn ExecuteProcess() public override StatusReturn ExecuteProcess()
{ {
var erroneousSequenceStep = false; var erroneousSequenceStep = false;
@@ -157,6 +157,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki
/// <remarks date="2025-Jun-18" author="Thomas Wiedebusch"> /// <remarks date="2025-Jun-18" author="Thomas Wiedebusch">
/// - Initial. /// - Initial.
/// </remarks> /// </remarks>
/// <remarks date="2025-Nov-21" author="Thomas Wiedebusch">
/// - Validate CSD.
/// </remarks>
public override StatusReturn ExecuteProcess() public override StatusReturn ExecuteProcess()
{ {
var erroneousSequenceStep = false; var erroneousSequenceStep = false;