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

View File

@ -466,7 +466,7 @@ Then Check the generic test results
# ================================================================================================================================
@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.
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

View File

@ -1897,14 +1897,14 @@ testRunner.Then("Check the generic test results", ((string)(null)), ((TechTalk.S
}
[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")]
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[] {
"CheckProductionStateProcess"};
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" +
"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 " +

View File

@ -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
/// </summary>
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 ------------------------------------------
@ -868,55 +871,52 @@ namespace Xylem.Common.Production.ProductionUiCordonel.UnitTests.Steps
/// <remarks date="2024-Dec-10" author="Thomas Wiedebusch">
/// - Login to build App list and registers.
/// </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)
{
// Generate list of tests out of the "Given" table and create test-cases
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;
// Check if presets are required, if so copy all properties using the Json.Deserializer to create a
// new object!!!
if (_presets.Meter != null)
// new object as deep copy!!!
if (_presetTestCase.Meter != null)
{
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);
//if (testCase.Meter == null)
//{
// testCase.Meter = new MockGenesis();
//}
// Special meter properties which are not include in the deep copy
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
{
testCase = NewTestRequirement();
}
// Enable register compare even if not physically read from meter
testCase.RegisterRestorer.RenewMeter(testCase.Meter);
testCase.RegisterRestorer.EnableCompareExternalSetRegisters();
testCase.CalibCheckRegisterRestorer.RenewMeter(testCase.Meter);
testCase.CalibCheckRegisterRestorer.EnableCompareExternalSetRegisters();
//// Enable register compare even if not physically read from meter
//testCase.RegisterRestorer.RenewMeter(testCase.Meter);
//testCase.RegisterRestorer.EnableCompareExternalSetRegisters();
//testCase.CalibCheckRegisterRestorer.RenewMeter(testCase.Meter);
//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();
//// 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();
// This is the multiple row test table defining individual test cases
ReadTable(row, ref testCase);
@ -936,20 +936,23 @@ namespace Xylem.Common.Production.ProductionUiCordonel.UnitTests.Steps
/// <remarks date="2024-Dec-10" author="Thomas Wiedebusch">
/// - Login to build App list and registers.
/// </remarks>
/// <remarks date="2025-Nov-22" author="Thomas Wiedebusch">
/// - Moved meter login to <see cref="NewTestRequirement"/>.
/// </remarks>
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.
// This register list will be used to check for valid ranges.
_presets.Meter?.Login();
//// Login is needed for building the MeterAppListVersion and generating the accessible register list.
//// This register list will be used to check for valid ranges.
//_presetTestCase.Meter?.Login();
// A preset table is limited to exclusively one row, those settings will be used for every test of the
// test-cases!
ReadTable(table.Rows[0], ref _presets);
ReadTable(table.Rows[0], ref _presetTestCase);
}
/// <summary>
@ -1755,6 +1758,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.UnitTests.Steps
/// <remarks date="2024-Nov-19" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
/// <remarks date="2025-Nov-22" author="Thomas Wiedebusch">
/// - Init meter and enable change of values for register restorers.
/// </remarks>
private static TestRequirement NewTestRequirement()
{
var testCase = new TestRequirement
@ -1772,6 +1778,13 @@ namespace Xylem.Common.Production.ProductionUiCordonel.UnitTests.Steps
};
testCase.RegisterRestorer = 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;
}

View File

@ -277,6 +277,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
/// be completed as the PcbId and the order number is needed.
/// Checks:
/// - Requirements are collected,
/// - Validate CSD,
/// - EOL progress for Sentinel can be generated,
/// - PcbId,
/// - Region,
@ -332,6 +333,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
/// <remarks date="2025-Mai-28" author="Thomas Wiedebusch">
/// - Check radio signal levels in parameter list.
/// </remarks>
/// <remarks date="2025-Nov-21" author="Thomas Wiedebusch">
/// - Validate CSD.
/// </remarks>
public override StatusReturn ExecuteProcess()
{
var erroneousSequenceStep = false;

View File

@ -157,6 +157,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki
/// <remarks date="2025-Jun-18" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
/// <remarks date="2025-Nov-21" author="Thomas Wiedebusch">
/// - Validate CSD.
/// </remarks>
public override StatusReturn ExecuteProcess()
{
var erroneousSequenceStep = false;