Skip to content

Commit

Permalink
Update following code review comments on test spec
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterC1965 committed Aug 29, 2024
1 parent 0fcfb23 commit 4e5f15a
Showing 1 changed file with 86 additions and 84 deletions.
170 changes: 86 additions & 84 deletions src/python_testing/TC_EWATERHTR_2_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,89 +50,90 @@ def pics_TC_EWATERHTR_2_3(self):
def steps_TC_EWATERHTR_2_3(self) -> list[TestStep]:
steps = [
TestStep("1", "Commission DUT to TH (can be skipped if done in a preceding test)"),
TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster",
TestStep("2", "Set up a subscription to all WaterHeaterManagement cluster events"),
TestStep("3", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster",
"Value has to be 1 (True)"),
TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Basic installation Test Event",
TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Basic installation Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("3a", "TH reads from the DUT the HeatDemand",
TestStep("4a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("3b", "TH reads from the DUT the BoostState",
TestStep("4b", "TH reads from the DUT the BoostState",
"Value has to be 0 (Inactive)"),
TestStep("3c", "TH reads from the DUT the TankPercentage",
TestStep("4c", "TH reads from the DUT the TankPercentage",
"Value has to be 0%"),
TestStep("3d", "TH reads from the DUT the HeaterTypes",
TestStep("4d", "TH reads from the DUT the HeaterTypes",
"Value has to be greater than 0x00 (at least one type supported) and Store the value as HeaterTypes"),
TestStep("4", "TH sends command Boost with Duration=600s,TargetPercentage=100%",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("4a", "TH reads from the DUT the HeatDemand",
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
TestStep("4b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
TestStep("5", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Water Temperature 61C Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("5", "TH sends command Boost with Duration=600s,TargetPercentage=100%",
"Verify DUT responds w/ status SUCCESS(0x00) and Event EWATERHTR.S.E00(BoostStarted) sent with Duration=600 and TargetPercentage=100"),
TestStep("5a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
TestStep("5b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
TestStep("5c", "TH reads from the DUT the TankPercentage",
"Value has to be 100%"),
TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Draw off hot water Test Event",
TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Water Temperature 61C Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("6a", "TH reads from the DUT the HeatDemand",
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
"Value has to be 0x00 (no demand on any source)"),
TestStep("6b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
TestStep("6c", "TH reads from the DUT the TankPercentage",
"Value has to be 75%"),
TestStep("7", "TH sends command CancelBoost",
"Value has to be 100%"),
TestStep("7", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Draw off hot water Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("7a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
TestStep("7b", "TH reads from the DUT the BoostState",
"Value has to be 0 (Inactive)"),
"Value has to be 1 (Active)"),
TestStep("7c", "TH reads from the DUT the TankPercentage",
"Value has to be 75%"),
TestStep("8", "TH sends command Boost with Duration=600s,TargetPercentage=100%,TargetReheat=65%",
"Verify DUT responds w/ status SUCCESS(0x00)"),
"Value has to be 76%"),
TestStep("8", "TH sends command CancelBoost",
"Verify DUT responds w/ status SUCCESS(0x00) and Event EWATERHTR.S.E00(BoostEnded) sent"),
TestStep("8a", "TH reads from the DUT the HeatDemand",
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
"Value has to be 0x00 (no demand on any source)"),
TestStep("8b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
"Value has to be 0 (Inactive)"),
TestStep("8c", "TH reads from the DUT the TankPercentage",
"Value has to be 75%"),
TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Water Temperature 61C Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
"Value has to be 76%"),
TestStep("9", "TH sends command Boost with Duration=400s,TargetPercentage=100%,TargetReheat=65%",
"Verify DUT responds w/ status SUCCESS(0x00) and Event EWATERHTR.S.E00(BoostStarted) sent with Duration=600 and TargetPercentage=100 and TargetReheat=65"),
TestStep("9a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
TestStep("9b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
TestStep("9c", "TH reads from the DUT the TankPercentage",
"Value has to be 100%"),
TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Draw off hot water Test Event",
"Value has to be 76%"),
TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Water Temperature 61C Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("10a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("10b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
TestStep("10c", "TH reads from the DUT the TankPercentage",
"Value has to be 75%"),
"Value has to be 100%"),
TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Draw off hot water Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("11a", "TH reads from the DUT the HeatDemand",
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
"Value has to be 0x00 (no demand on any source)"),
TestStep("11b", "TH reads from the DUT the BoostState",
"Value has to be 1 (Active)"),
TestStep("11c", "TH reads from the DUT the TankPercentage",
"Value has to be 50%"),
TestStep("12", "TH sends command CancelBoost",
"Value has to be 76%"),
TestStep("12", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Draw off hot water Test Event",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("12a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
"Value has to be greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"),
TestStep("12b", "TH reads from the DUT the BoostState",
"Value has to be 0 (Inactive)"),
"Value has to be 1 (Active)"),
TestStep("12c", "TH reads from the DUT the TankPercentage",
"Value has to be 50%"),
TestStep("13", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Basic installation Test Event Clear",
"Value has to be 57%"),
TestStep("13", "TH sends command CancelBoost",
"Verify DUT responds w/ status SUCCESS(0x00) and Event EWATERHTR.S.E00(BoostEnded) sent"),
TestStep("13a", "TH reads from the DUT the HeatDemand",
"Value has to be 0x00 (no demand on any source)"),
TestStep("13b", "TH reads from the DUT the BoostState",
"Value has to be 0 (Inactive)"),
TestStep("13c", "TH reads from the DUT the TankPercentage",
"Value has to be 57%"),
TestStep("14", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TESTEVENT_TRIGGERKEY and EventTrigger field set to PIXIT.EWATERHTR.TESTEVENTTRIGGER for Basic installation Test Event Clear",
"Verify DUT responds w/ status SUCCESS(0x00)"),
]

Expand All @@ -144,159 +145,160 @@ async def test_TC_EWATERHTR_2_3(self):
self.step("1")
# Commission DUT - already done

self.step("2")
# Subscribe to Events and when they are sent push them to a queue for checking later
events_callback = EventChangeCallback(Clusters.WaterHeaterManagement)
await events_callback.start(self.default_controller,
self.dut_node_id,
self.matter_test_config.endpoint)

self.step("2")
self.step("3")
await self.check_test_event_triggers_enabled()

self.step("3")
self.step("4")
await self.send_test_event_trigger_basic_installation_test_event()

self.step("3a")
self.step("4a")
await self.check_whm_attribute("HeatDemand", 0)

self.step("3b")
self.step("4b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive)

self.step("3c")
self.step("4c")
await self.check_whm_attribute("TankPercentage", 0)

self.step("3d")
self.step("4d")
heaterTypes = await self.read_whm_attribute_expect_success(attribute="HeaterTypes")
asserts.assert_greater(heaterTypes, 0)

self.step("4")
self.step("5")
await self.send_boost_command(duration=600, target_percentage=100)

event_data = events_callback.wait_for_event_report(Clusters.WaterHeaterManagement.Events.BoostStarted)
asserts.assert_equal(event_data.boostInfo.duration, 600)
asserts.assert_equal(event_data.boostInfo.targetPercentage, 100)

self.step("4a")
self.step("5a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_greater(heatDemand, 0)
asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"),

self.step("4b")
self.step("5b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)

self.step("5")
self.step("6")
await self.send_test_event_trigger_water_temperature61C_test_event()

self.step("5a")
self.step("6a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_equal(heatDemand, 0)

self.step("5b")
self.step("6b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)

self.step("5c")
self.step("6c")
await self.check_whm_attribute("TankPercentage", 100)

self.step("6")
self.step("7")
await self.send_test_event_trigger_draw_off_hot_water_test_event()

self.step("6a")
self.step("7a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_greater(heatDemand, 0)
asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"),

self.step("6b")
self.step("7b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)

self.step("6c")
self.step("7c")
await self.check_whm_attribute("TankPercentage", 76)

self.step("7")
self.step("8")
await self.send_cancel_boost_command()

event_data = events_callback.wait_for_event_report(Clusters.WaterHeaterManagement.Events.BoostEnded)

self.step("7a")
self.step("8a")
await self.check_whm_attribute("HeatDemand", 0)

self.step("7b")
self.step("8b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive)

self.step("7c")
self.step("8c")
await self.check_whm_attribute("TankPercentage", 76)

self.step("8")
self.step("9")
await self.send_boost_command(duration=400, target_percentage=100, target_reheat=65)

event_data = events_callback.wait_for_event_report(Clusters.WaterHeaterManagement.Events.BoostStarted)
asserts.assert_equal(event_data.boostInfo.duration, 400)
asserts.assert_equal(event_data.boostInfo.targetPercentage, 100)
asserts.assert_equal(event_data.boostInfo.targetReheat, 65)

self.step("8a")
self.step("9a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_greater(heatDemand, 0)
asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"),

self.step("8b")
self.step("9b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)

self.step("8c")
self.step("9c")
await self.check_whm_attribute("TankPercentage", 76)

self.step("9")
self.step("10")
await self.send_test_event_trigger_water_temperature61C_test_event()

self.step("9a")
self.step("10a")
await self.check_whm_attribute("HeatDemand", 0)

self.step("9b")
self.step("10b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)

self.step("9c")
self.step("10c")
await self.check_whm_attribute("TankPercentage", 100)

self.step("10")
self.step("11")
await self.send_test_event_trigger_draw_off_hot_water_test_event()

self.step("10a")
self.step("11a")
await self.check_whm_attribute("HeatDemand", 0)

self.step("10b")
self.step("11b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)

self.step("10c")
self.step("11c")
await self.check_whm_attribute("TankPercentage", 76)

self.step("11")
self.step("12")
await self.send_test_event_trigger_draw_off_hot_water_test_event()

self.step("11a")
self.step("12a")
heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand")
asserts.assert_greater(heatDemand, 0)
asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"),

self.step("11b")
self.step("12b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive)

self.step("11c")
self.step("12c")
await self.check_whm_attribute("TankPercentage", 57)

self.step("12")
self.step("13")
await self.send_cancel_boost_command()

event_data = events_callback.wait_for_event_report(Clusters.WaterHeaterManagement.Events.BoostEnded)

self.step("12a")
self.step("13a")
await self.check_whm_attribute("HeatDemand", 0)

self.step("12b")
self.step("13b")
await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive)

self.step("12c")
self.step("13c")
await self.check_whm_attribute("TankPercentage", 57)

self.step("13")
self.step("14")
await self.send_test_event_trigger_basic_installation_test_event_clear()


Expand Down

0 comments on commit 4e5f15a

Please sign in to comment.