From f9dfb283614570be1f3635c6a7ec98b501cb7adf Mon Sep 17 00:00:00 2001 From: pcoleman Date: Mon, 15 Jul 2024 20:50:12 +0100 Subject: [PATCH 01/27] Add water heater management test scripts --- src/python_testing/EWATERHTRBase.py | 94 ++++++++ src/python_testing/TC_EWATERHTR_2_1.py | 78 +++++++ src/python_testing/TC_EWATERHTR_2_2.py | 299 +++++++++++++++++++++++++ src/python_testing/TC_EWATERHTR_2_3.py | 229 +++++++++++++++++++ 4 files changed, 700 insertions(+) create mode 100644 src/python_testing/EWATERHTRBase.py create mode 100644 src/python_testing/TC_EWATERHTR_2_1.py create mode 100644 src/python_testing/TC_EWATERHTR_2_2.py create mode 100644 src/python_testing/TC_EWATERHTR_2_3.py diff --git a/src/python_testing/EWATERHTRBase.py b/src/python_testing/EWATERHTRBase.py new file mode 100644 index 00000000000000..1a31ba7337913e --- /dev/null +++ b/src/python_testing/EWATERHTRBase.py @@ -0,0 +1,94 @@ +# +# Copyright (c) 2023 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import logging +import typing + +import chip.clusters as Clusters +from chip.interaction_model import InteractionModelError, Status +from mobly import asserts + +logger = logging.getLogger(__name__) + + +class EWATERHTRBase: + + async def read_whm_attribute_expect_success(self, endpoint: int = None, attribute: str = ""): + cluster = Clusters.Objects.WaterHeaterManagement + full_attr = getattr(cluster.Attributes, attribute) + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=full_attr) + + async def check_whm_attribute(self, attribute, expected_value, endpoint: int = None): + value = await self.read_whm_attribute_expect_success(endpoint=endpoint, attribute=attribute) + asserts.assert_equal(value, expected_value, + f"Unexpected '{attribute}' value - expected {expected_value}, was {value}") + + async def send_boost_command(self, duration: int, one_shot: typing.Optional[bool] = None, emergency_boost: typing.Optional[bool] = None, + temporary_setpoint: typing.Optional[int] = None, target_percentage: typing.Optional[int] = None, target_reheat: typing.Optional[int] = None, + endpoint: int = None, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.WaterHeaterManagement.Commands.Boost( + duration=duration, + oneShot=one_shot, + emergencyBoost=emergency_boost, + temporarySetpoint=temporary_setpoint, + targetPercentage=target_percentage, + targetReheat=target_reheat), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + asserts.assert_equal(expected_status, Status.Success) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_cancel_boost_command(self, endpoint: int = None, timedRequestTimeoutMs: int = 3000, + expected_status: Status = Status.Success): + try: + await self.send_single_cmd(cmd=Clusters.WaterHeaterManagement.Commands.CancelBoost(), + endpoint=endpoint, + timedRequestTimeoutMs=timedRequestTimeoutMs) + + asserts.assert_equal(expected_status, Status.Success) + + except InteractionModelError as e: + asserts.assert_equal(e.status, expected_status, "Unexpected error returned") + + async def send_test_event_trigger_basic_installation_test_event(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000000) + + async def send_test_event_trigger_basic_installation_test_event_clear(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000001) + + async def send_test_event_trigger_water_temperature20C_test_event(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000002) + + async def send_test_event_trigger_water_temperature61C_test_event(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000003) + + async def send_test_event_trigger_water_temperature66C_test_event(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000004) + + async def send_test_event_trigger_manual_mode_test_event(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000005) + + async def send_test_event_trigger_off_mode_test_event(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000006) + + async def send_test_event_trigger_draw_off_hot_water_test_event(self): + await self.send_test_event_triggers(eventTrigger=0x0094000000000007) diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py new file mode 100644 index 00000000000000..6fbdb18b6e8669 --- /dev/null +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -0,0 +1,78 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import logging + +import chip.clusters as Clusters +from EWATERHTRBase import EWATERHTRBase +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main + +logger = logging.getLogger(__name__) + + +class TC_EWATERHTR_2_1(MatterBaseTest, EWATERHTRBase): + + def desc_TC_EWATERHTR_2_1(self) -> str: + """Returns a description of this test""" + return "[TC-EWATERHTR-2.1] Attributes with attributes with DUT as Server\n" \ + "This test case verifies the non-global attributes of the Water Heater Management cluster server." + + def pics_TC_EWATERHTR_2_1(self): + """ This function returns a list of PICS for this test case that must be True for the test to be run""" + return ["EWATERHTR.S", "EWATERHTR.S.F00", "EWATERHTR.S.F01"] + + def steps_TC_EWATERHTR_2_1(self) -> list[TestStep]: + steps = [ + TestStep("1", "Commissioning, already done", is_commissioning=True), + TestStep("2a", "TH reads HeaterTypes attribute. DUT as Server replies with a WaterHeaterTypeBitmap (enum8) value to match the DUT type."), + TestStep("2b", "TH reads HeatDemand attribute. DUT as Server replies with a WaterHeaterDemandBitmap (enum8)."), + TestStep("2c", "TH reads TankVolume attribute. DUT as Server replies with a uint16 value."), + TestStep("2d", "TH reads EstimatedHeatRequired attribute. DUT as Server replies with an energy-mWh value."), + TestStep("2e", "TH reads TankPercentage attribute. DUT as Server replies with a percent value."), + TestStep("2f", "TH reads BoostState attribute. DUT as Server replies with a BoostStateEnum (enum8) value."), + ] + + return steps + + @async_test_body + async def test_TC_EWATERHTR_2_1(self): + + self.step("1") + # Commission DUT - already done + + # Note the values used here are configured in WhmManufacturer::Init() + self.step("2a") + await self.check_whm_attribute("HeaterTypes", 0) + + self.step("2b") + await self.check_whm_attribute("HeatDemand", 0) + + self.step("2c") + await self.check_whm_attribute("TankVolume", 0) + + self.step("2d") + await self.check_whm_attribute("EstimatedHeatRequired", 0) + + self.step("2e") + await self.check_whm_attribute("TankPercentage", 0) + + self.step("2f") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_EWATERHTR_2_2.py b/src/python_testing/TC_EWATERHTR_2_2.py new file mode 100644 index 00000000000000..e27929fe365584 --- /dev/null +++ b/src/python_testing/TC_EWATERHTR_2_2.py @@ -0,0 +1,299 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import logging +import time + +import chip.clusters as Clusters +from EWATERHTRBase import EWATERHTRBase +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + +logger = logging.getLogger(__name__) + + +class TC_EWATERHTR_2_2(MatterBaseTest, EWATERHTRBase): + + def desc_TC_EWATERHTR_2_2(self) -> str: + """Returns a description of this test""" + return "[TC-EWATERHTR-2.2] Basic functionality with attributes with DUT as Server\n" \ + "This test case verifies the primary functionality of the Water Heater Management cluster server." + + def pics_TC_EWATERHTR_2_2(self): + """ This function returns a list of PICS for this test case that must be True for the test to be run""" + return ["EWATERHTR.S"] + + def steps_TC_EWATERHTR_2_2(self) -> list[TestStep]: + steps = [ + TestStep("1", "Commissioning, already done", is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify value is 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event. Verify Command response is Success"), + TestStep("3a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("3b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), + TestStep( + "3c", "TH reads HeaterTypes attribute. Verify value is greater than 0x00 (at least one type supported) and {storeValueAs} HeaterTypes"), + TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Manual mode Test Event. Verify Command response is Success"), + TestStep("4a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("5", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event. Verify Command response is Success"), + TestStep("5a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 20C Test Event. Verify Command response is Success"), + TestStep("6a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source)"), + TestStep("7", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Off mode Test Event. Verify Command response is Success"), + TestStep("7a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("8", "TH sends Boost with Duration=5s,OneShot=True. Verify Command response is Success"), + TestStep("8a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("8b", "TH reads BoostState attribute. Verify value is 1 (Active)"), + TestStep("9", "Wait 6 seconds"), + TestStep("9a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("9b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), + TestStep("10", "TH sends Boost with Duration=600s,OneShot=True. Verify Command response is Success"), + TestStep("10a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("10b", "TH reads BoostState attribute. Verify value is 1 (Active)"), + TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event. Verify Command response is Success"), + TestStep("11a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("11b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), + TestStep("12", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 20C Test Event. Verify Command response is Success"), + TestStep("12a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("13", "TH sends Boost with Duration=600s. Verify Command response is Success"), + TestStep("13a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("13b", "TH reads BoostState attribute. Verify value is 1 (Active)"), + TestStep("14", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event. Verify Command response is Success"), + TestStep("14a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("14b", "TH reads BoostState attribute. Verify value is 1 (Active)"), + TestStep("15", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 20C Test Event. Verify Command response is Success"), + TestStep("15a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("15b", "TH reads BoostState attribute. Verify value is 1 (Active)"), + TestStep("16", "TH sends CancelBoost. Verify Command response is Success"), + TestStep("16a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("16b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), + TestStep("17", "TH sends Boost with Duration=600s,TemporarySetpoint=65C. Verify Command response is Success"), + TestStep("17a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("17b", "TH reads BoostState attribute. Verify value is 1 (Active)"), + TestStep("18", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event. Verify Command response is Success"), + TestStep("18a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("18b", "TH reads BoostState attribute. Verify value is 1 (Active)"), + TestStep("19", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 66C Test Event. Verify Command response is Success"), + TestStep("19a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("19b", "TH reads BoostState attribute. Verify value is 1 (Active)"), + TestStep("20", "TH sends Boost with Duration=600s,TemporarySetpoint=70C. Verify Command response is Success"), + TestStep("20a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("20b", "TH reads BoostState attribute. Verify value is 1 (Active)"), + TestStep("21", "TH sends CancelBoost. Verify Command response is Success"), + TestStep("21a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("21b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), + TestStep("22", "TH sends CancelBoost. Verify Command response is Success"), + TestStep("23", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event Clear. Verify Command response is Success"), + ] + + return steps + + @async_test_body + async def test_TC_EWATERHTR_2_2(self): + + self.step("1") + # Commission DUT - already done + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_basic_installation_test_event() + + self.step("3a") + await self.check_whm_attribute("HeatDemand", 0) + + self.step("3b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("3c") + heaterTypes = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") + asserts.assert_equal(heaterTypes, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kImmersionElement1) + + self.step("4") + await self.send_test_event_trigger_manual_mode_test_event() + + self.step("4a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + + self.step("5") + await self.send_test_event_trigger_water_temperature61C_test_event() + + self.step("5a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("6") + await self.send_test_event_trigger_water_temperature20C_test_event() + + self.step("6a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + + self.step("7") + await self.send_test_event_trigger_off_mode_test_event() + + self.step("7a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("8") + await self.send_boost_command(duration=5, one_shot=True) + + self.step("8a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + + self.step("8b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("9") + time.sleep(6) + + self.step("9a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("9b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("10") + await self.send_boost_command(duration=600, one_shot=True) + + self.step("10a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + + self.step("10b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("11") + await self.send_test_event_trigger_water_temperature61C_test_event() + + self.step("11a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("11b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("12") + await self.send_test_event_trigger_water_temperature20C_test_event() + + self.step("12a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("13") + await self.send_boost_command(duration=600) + + self.step("13a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + + self.step("13b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("14") + await self.send_test_event_trigger_water_temperature61C_test_event() + + self.step("14a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("14b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("15") + await self.send_test_event_trigger_water_temperature20C_test_event() + + self.step("15a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + + self.step("15b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("16") + await self.send_cancel_boost_command() + + self.step("16a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("16b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("17") + await self.send_boost_command(duration=600, temporary_setpoint=6500) + + self.step("17a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + + self.step("17b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("18") + await self.send_test_event_trigger_water_temperature61C_test_event() + + self.step("18a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + + self.step("18b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("19") + await self.send_test_event_trigger_water_temperature66C_test_event() + + self.step("19a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("19b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("20") + await self.send_boost_command(duration=600, temporary_setpoint=7000) + + self.step("20a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + + self.step("20b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("21") + await self.send_cancel_boost_command() + + self.step("21a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("21b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("22") + await self.send_cancel_boost_command() + + self.step("23") + await self.send_test_event_trigger_basic_installation_test_event_clear() + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_EWATERHTR_2_3.py b/src/python_testing/TC_EWATERHTR_2_3.py new file mode 100644 index 00000000000000..61bab0118918c8 --- /dev/null +++ b/src/python_testing/TC_EWATERHTR_2_3.py @@ -0,0 +1,229 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import logging + +import chip.clusters as Clusters +from EWATERHTRBase import EWATERHTRBase +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + +logger = logging.getLogger(__name__) + + +class TC_EWATERHTR_2_3(MatterBaseTest, EWATERHTRBase): + + def desc_TC_EWATERHTR_2_3(self) -> str: + """Returns a description of this test""" + return "[TC-EWATERHTR-2.3] Attributes with attributes with DUT as Server\n" \ + "This test case verifies the functionality of the Water Heater Management cluster server with the TankPercentage feature." + + def pics_TC_EWATERHTR_2_3(self): + """ This function returns a list of PICS for this test case that must be True for the test to be run""" + return ["EWATERHTR.S", "EWATERHTR.S.F01"] + + def steps_TC_EWATERHTR_2_3(self) -> list[TestStep]: + steps = [ + TestStep("1", "Commissioning, already done", is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify value is 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event. Verify Command response is Success"), + TestStep("3a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("3b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), + TestStep("3c", "TH reads TankPercentage attribute. Verify value is 0%"), + TestStep( + "3d", "TH reads HeaterTypes attribute. Verify value is greater than 0x00 (at least one type supported) and {storeValueAs} HeaterTypes"), + TestStep("4", "TH sends Boost with Duration=600s,TargetPercentage=100%. Verify Command response is Success"), + TestStep("4a", "TH reads HeatDemand attribute. Verify value is 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 BoostState attribute. Verify value is 1 (Active)"), + TestStep("5", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event. Verify Command response is Success"), + TestStep("5a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("5b", "TH reads BoostState attribute. Verify value is 0 (Active)"), + TestStep("5c", "TH reads TankPercentage attribute. Verify value is 100%"), + TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Draw off hot water Test Event. Verify Command response is Success"), + TestStep("6a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("6b", "TH reads BoostState attribute. Verify value is 0 (Active)"), + TestStep("6c", "TH reads TankPercentage attribute. Verify value is 75%"), + TestStep("7", "TH sends CancelBoost. Verify Command response is Success"), + TestStep("7a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("7b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), + TestStep("7c", "TH reads TankPercentage attribute. Verify value is 75%"), + TestStep("8", "TH sends Boost with Duration=600s,TargetPercentage=100%,TargetReheat=65%. Verify Command response is Success"), + TestStep("8a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("8b", "TH reads BoostState attribute. Verify value is 1 (Active)"), + TestStep("8c", "TH reads TankPercentage attribute. Verify value is 75%"), + TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event. Verify Command response is Success"), + TestStep("9a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("9b", "TH reads BoostState attribute. Verify value is 1 (Active)"), + TestStep("9c", "TH reads TankPercentage attribute. Verify value is 100%"), + TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Draw off hot water Test Event. Verify Command response is Success"), + TestStep("10a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("10b", "TH reads BoostState attribute. Verify value is 1 (Active)"), + TestStep("10c", "TH reads TankPercentage attribute. Verify value is 75%"), + TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Draw off hot water Test Event. Verify Command response is Success"), + TestStep("11a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("11b", "TH reads BoostState attribute. Verify value is 1 (Active)"), + TestStep("11c", "TH reads TankPercentage attribute. Verify value is 50%"), + TestStep("12", "TH sends CancelBoost. Verify Command response is Success"), + TestStep("12a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), + TestStep("12b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), + TestStep("12c", "TH reads TankPercentage attribute. Verify value is 50%"), + TestStep("13", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event Clear. Verify Command response is Success"), + ] + + return steps + + @async_test_body + async def test_TC_EWATERHTR_2_3(self): + + self.step("1") + # Commission DUT - already done + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_basic_installation_test_event() + + self.step("3a") + await self.check_whm_attribute("HeatDemand", 0) + + self.step("3b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("3c") + await self.check_whm_attribute("TankPercentage", 0) + + self.step("3d") + heaterTypes = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") + asserts.assert_equal(heaterTypes, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kImmersionElement1) + + self.step("4") + await self.send_boost_command(duration=600, target_percentage=100) + + self.step("4a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + + self.step("4b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("5") + await self.send_test_event_trigger_water_temperature61C_test_event() + + self.step("5a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_equal(heatDemand, 0) + + self.step("5b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("5c") + await self.check_whm_attribute("TankPercentage", 100) + + self.step("6") + await self.send_test_event_trigger_draw_off_hot_water_test_event() + + self.step("6a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + + self.step("6b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("6c") + await self.check_whm_attribute("TankPercentage", 75) + + self.step("7") + await self.send_cancel_boost_command() + + self.step("7a") + await self.check_whm_attribute("HeatDemand", 0) + + self.step("7b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("7c") + await self.check_whm_attribute("TankPercentage", 75) + + self.step("8") + await self.send_boost_command(duration=600, target_percentage=100, target_reheat=65) + + self.step("8a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + + self.step("8b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("8c") + await self.check_whm_attribute("TankPercentage", 75) + + self.step("9") + await self.send_test_event_trigger_water_temperature61C_test_event() + + self.step("9a") + await self.check_whm_attribute("HeatDemand", 0) + + self.step("9b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("9c") + await self.check_whm_attribute("TankPercentage", 100) + + self.step("10") + await self.send_test_event_trigger_draw_off_hot_water_test_event() + + self.step("10a") + await self.check_whm_attribute("HeatDemand", 0) + + self.step("10b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("10c") + await self.check_whm_attribute("TankPercentage", 75) + + self.step("11") + await self.send_test_event_trigger_draw_off_hot_water_test_event() + + self.step("11a") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + + self.step("11b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) + + self.step("11c") + await self.check_whm_attribute("TankPercentage", 50) + + self.step("12") + await self.send_cancel_boost_command() + + self.step("12a") + await self.check_whm_attribute("HeatDemand", 0) + + self.step("12b") + await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + + self.step("12c") + await self.check_whm_attribute("TankPercentage", 50) + + self.step("13") + await self.send_test_event_trigger_basic_installation_test_event_clear() + + +if __name__ == "__main__": + default_matter_test_main() From 3a803e0926d3d2d71b9ef7ad5758f0ba3f2ebacd Mon Sep 17 00:00:00 2001 From: pcoleman Date: Tue, 16 Jul 2024 16:41:14 +0100 Subject: [PATCH 02/27] Define runner commands for WHM tests --- .github/workflows/tests.yaml | 1 + scripts/tests/py/test_metadata.py | 1 + src/python_testing/TC_EEVSE_2_4.py | 1 + src/python_testing/TC_EWATERHTR_2_1.py | 11 +++++++++++ src/python_testing/TC_EWATERHTR_2_2.py | 12 ++++++++++++ src/python_testing/TC_EWATERHTR_2_3.py | 11 +++++++++++ 6 files changed, 37 insertions(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 53195008ba4222..22bcbd20dc7936 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -485,6 +485,7 @@ jobs: echo "ALL_CLUSTERS_APP: out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app" >> /tmp/test_env.yaml echo "CHIP_LOCK_APP: out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app" >> /tmp/test_env.yaml echo "ENERGY_MANAGEMENT_APP: out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app" >> /tmp/test_env.yaml + echo "WATER_HEATER_MANAGEMENT_APP: out/linux-x64-water-heater-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-water-heater-management-app" >> /tmp/test_env.yaml echo "LIT_ICD_APP: out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app" >> /tmp/test_env.yaml echo "CHIP_MICROWAVE_OVEN_APP: out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app" >> /tmp/test_env.yaml echo "CHIP_RVC_APP: out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app" >> /tmp/test_env.yaml diff --git a/scripts/tests/py/test_metadata.py b/scripts/tests/py/test_metadata.py index a0c12a0ab0ed5a..6915604ce2142f 100644 --- a/scripts/tests/py/test_metadata.py +++ b/scripts/tests/py/test_metadata.py @@ -34,6 +34,7 @@ class TestMetadataReader(unittest.TestCase): ALL_CLUSTERS_APP: out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app CHIP_LOCK_APP: out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app ENERGY_MANAGEMENT_APP: out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app + WATER_HEATER_MANAGEMENT_APP: out/linux-x64-water-heater-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-water-heater-management-app TRACE_APP: out/trace_data/app-{SCRIPT_BASE_NAME} TRACE_TEST_JSON: out/trace_data/test-{SCRIPT_BASE_NAME} TRACE_TEST_PERFETTO: out/trace_data/test-{SCRIPT_BASE_NAME} diff --git a/src/python_testing/TC_EEVSE_2_4.py b/src/python_testing/TC_EEVSE_2_4.py index b2618f4e6035af..ff321fe1e948aa 100644 --- a/src/python_testing/TC_EEVSE_2_4.py +++ b/src/python_testing/TC_EEVSE_2_4.py @@ -21,6 +21,7 @@ # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto + import logging import time diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py index 6fbdb18b6e8669..0bbd7b13fde018 100644 --- a/src/python_testing/TC_EWATERHTR_2_1.py +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -15,6 +15,17 @@ # limitations under the License. +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS ===# test-runner-runs: run1 +# test-runner-run/run1/app: ${WATER_HEATER_MANAGEMENT_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + import logging import chip.clusters as Clusters diff --git a/src/python_testing/TC_EWATERHTR_2_2.py b/src/python_testing/TC_EWATERHTR_2_2.py index e27929fe365584..73c500c93b5cc1 100644 --- a/src/python_testing/TC_EWATERHTR_2_2.py +++ b/src/python_testing/TC_EWATERHTR_2_2.py @@ -15,6 +15,18 @@ # limitations under the License. +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS ===# test-runner-runs: run1 +# test-runner-run/run1/app: ${WATER_HEATER_MANAGEMENT_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + + import logging import time diff --git a/src/python_testing/TC_EWATERHTR_2_3.py b/src/python_testing/TC_EWATERHTR_2_3.py index 61bab0118918c8..680c779e614a72 100644 --- a/src/python_testing/TC_EWATERHTR_2_3.py +++ b/src/python_testing/TC_EWATERHTR_2_3.py @@ -14,6 +14,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS ===# test-runner-runs: run1 +# test-runner-run/run1/app: ${WATER_HEATER_MANAGEMENT_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + import logging From cf7844cf26f6e16080f949bd7a2a1cdbd5ef4a9f Mon Sep 17 00:00:00 2001 From: pcoleman Date: Thu, 18 Jul 2024 19:49:37 +0100 Subject: [PATCH 03/27] Specify --featureSet option on runner command line --- src/python_testing/TC_EWATERHTR_2_1.py | 2 +- src/python_testing/TC_EWATERHTR_2_2.py | 2 +- src/python_testing/TC_EWATERHTR_2_3.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py index 0bbd7b13fde018..2799685dcbb84b 100644 --- a/src/python_testing/TC_EWATERHTR_2_1.py +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -22,7 +22,7 @@ # test-runner-run/run1/app: ${WATER_HEATER_MANAGEMENT_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True -# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x03 # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto # === END CI TEST ARGUMENTS === diff --git a/src/python_testing/TC_EWATERHTR_2_2.py b/src/python_testing/TC_EWATERHTR_2_2.py index 73c500c93b5cc1..bd2cf3738908ab 100644 --- a/src/python_testing/TC_EWATERHTR_2_2.py +++ b/src/python_testing/TC_EWATERHTR_2_2.py @@ -22,7 +22,7 @@ # test-runner-run/run1/app: ${WATER_HEATER_MANAGEMENT_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True -# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x03 # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto # === END CI TEST ARGUMENTS === diff --git a/src/python_testing/TC_EWATERHTR_2_3.py b/src/python_testing/TC_EWATERHTR_2_3.py index 680c779e614a72..2505ab67d3da7f 100644 --- a/src/python_testing/TC_EWATERHTR_2_3.py +++ b/src/python_testing/TC_EWATERHTR_2_3.py @@ -21,7 +21,7 @@ # test-runner-run/run1/app: ${WATER_HEATER_MANAGEMENT_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True -# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x03 # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto # === END CI TEST ARGUMENTS === From a4f8ca629e73d6235a245a61c911660101a78ff4 Mon Sep 17 00:00:00 2001 From: pcoleman Date: Mon, 22 Jul 2024 09:13:04 +0100 Subject: [PATCH 04/27] Add the --featureSet option to the RUNNER command line --- src/python_testing/TC_EWATERHTR_2_2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_EWATERHTR_2_2.py b/src/python_testing/TC_EWATERHTR_2_2.py index bd2cf3738908ab..6367e3b6413f22 100644 --- a/src/python_testing/TC_EWATERHTR_2_2.py +++ b/src/python_testing/TC_EWATERHTR_2_2.py @@ -22,7 +22,7 @@ # test-runner-run/run1/app: ${WATER_HEATER_MANAGEMENT_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True -# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x03 +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x00 # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto # === END CI TEST ARGUMENTS === From 7ca996feb1c40e1cb4dc163afde1aa283669ef62 Mon Sep 17 00:00:00 2001 From: jamesharrow <93921463+jamesharrow@users.noreply.github.com> Date: Wed, 24 Jul 2024 22:42:10 +0100 Subject: [PATCH 05/27] Apply suggestions from code review - corrected test step numbers to align to test plan PR. --- src/python_testing/EWATERHTRBase.py | 2 +- src/python_testing/TC_EWATERHTR_2_1.py | 30 +++++++++++++++----------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/python_testing/EWATERHTRBase.py b/src/python_testing/EWATERHTRBase.py index 1a31ba7337913e..0bf42a7eb4d0a0 100644 --- a/src/python_testing/EWATERHTRBase.py +++ b/src/python_testing/EWATERHTRBase.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2024 Project CHIP Authors # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py index 2799685dcbb84b..e3f28859a6ba5f 100644 --- a/src/python_testing/TC_EWATERHTR_2_1.py +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -49,12 +49,18 @@ def pics_TC_EWATERHTR_2_1(self): def steps_TC_EWATERHTR_2_1(self) -> list[TestStep]: steps = [ TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2a", "TH reads HeaterTypes attribute. DUT as Server replies with a WaterHeaterTypeBitmap (enum8) value to match the DUT type."), - TestStep("2b", "TH reads HeatDemand attribute. DUT as Server replies with a WaterHeaterDemandBitmap (enum8)."), - TestStep("2c", "TH reads TankVolume attribute. DUT as Server replies with a uint16 value."), - TestStep("2d", "TH reads EstimatedHeatRequired attribute. DUT as Server replies with an energy-mWh value."), - TestStep("2e", "TH reads TankPercentage attribute. DUT as Server replies with a percent value."), - TestStep("2f", "TH reads BoostState attribute. DUT as Server replies with a BoostStateEnum (enum8) value."), + TestStep("2", "TH reads HeaterTypes attribute.", + "DUT as Server replies with a WaterHeaterTypeBitmap (enum8)greater than 0x00 (at least one type supported), and less than 0x20 (no undefined types supported)."), + TestStep("3", "TH reads HeatDemand attribute.", + "DUT as Server replies with a WaterHeaterDemandBitmap (enum8)."), + TestStep("4", "TH reads TankVolume attribute.", + "DUT as Server replies with a uint16 value."), + TestStep("5", "TH reads EstimatedHeatRequired attribute.", + "DUT as Server replies with an energy-mWh value."), + TestStep("6", "TH reads TankPercentage attribute.", + "DUT as Server replies with a percent value."), + TestStep("7", "TH reads BoostState attribute.", + "DUT as Server replies with a BoostStateEnum (enum8) value."), ] return steps @@ -66,22 +72,22 @@ async def test_TC_EWATERHTR_2_1(self): # Commission DUT - already done # Note the values used here are configured in WhmManufacturer::Init() - self.step("2a") + self.step("2") await self.check_whm_attribute("HeaterTypes", 0) - self.step("2b") + self.step("3") await self.check_whm_attribute("HeatDemand", 0) - self.step("2c") + self.step("4") await self.check_whm_attribute("TankVolume", 0) - self.step("2d") + self.step("5") await self.check_whm_attribute("EstimatedHeatRequired", 0) - self.step("2e") + self.step("6") await self.check_whm_attribute("TankPercentage", 0) - self.step("2f") + self.step("7") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) From 70e516b31f03789bcf2f9bd089cdbcae9ffd0069 Mon Sep 17 00:00:00 2001 From: jamesharrow <93921463+jamesharrow@users.noreply.github.com> Date: Wed, 24 Jul 2024 22:43:33 +0100 Subject: [PATCH 06/27] Apply suggestions from code review - Changing TestSteps into 3 entries --- src/python_testing/TC_EWATERHTR_2_2.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/python_testing/TC_EWATERHTR_2_2.py b/src/python_testing/TC_EWATERHTR_2_2.py index 6367e3b6413f22..641b4e1f63759c 100644 --- a/src/python_testing/TC_EWATERHTR_2_2.py +++ b/src/python_testing/TC_EWATERHTR_2_2.py @@ -52,14 +52,21 @@ def pics_TC_EWATERHTR_2_2(self): def steps_TC_EWATERHTR_2_2(self) -> list[TestStep]: steps = [ TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify value is 1 (True)"), - TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event. Verify Command response is Success"), - TestStep("3a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("3b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.", + "Verify value is 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event.", + "Verify Command response is Success"), + TestStep("3a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("3b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), TestStep( - "3c", "TH reads HeaterTypes attribute. Verify value is greater than 0x00 (at least one type supported) and {storeValueAs} HeaterTypes"), - TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Manual mode Test Event. Verify Command response is Success"), - TestStep("4a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + "3c", "TH reads HeaterTypes attribute.", + "Verify value is greater than 0x00 (at least one type supported) and store the value as HeaterTypes"), + TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Manual mode Test Event.", + "Verify Command response is Success"), + TestStep("4a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), TestStep("5", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event. Verify Command response is Success"), TestStep("5a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 20C Test Event. Verify Command response is Success"), From 50b8a54bdc8007e6a483d6c4fc2da4c9b0699dd1 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Wed, 24 Jul 2024 23:10:26 +0100 Subject: [PATCH 07/27] Renamed EWATERHTRBase.py to TC_EWATERHTRBase.py. Changed TestStep to 3 args entries (to split out verification step for readability). --- .../{EWATERHTRBase.py => TC_EWATERHTRBase.py} | 0 src/python_testing/TC_EWATERHTR_2_1.py | 23 +- src/python_testing/TC_EWATERHTR_2_2.py | 198 +++++++++++------- src/python_testing/TC_EWATERHTR_2_3.py | 149 ++++++++----- 4 files changed, 238 insertions(+), 132 deletions(-) rename src/python_testing/{EWATERHTRBase.py => TC_EWATERHTRBase.py} (100%) diff --git a/src/python_testing/EWATERHTRBase.py b/src/python_testing/TC_EWATERHTRBase.py similarity index 100% rename from src/python_testing/EWATERHTRBase.py rename to src/python_testing/TC_EWATERHTRBase.py diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py index e3f28859a6ba5f..497544ba7313f3 100644 --- a/src/python_testing/TC_EWATERHTR_2_1.py +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -29,7 +29,7 @@ import logging import chip.clusters as Clusters -from EWATERHTRBase import EWATERHTRBase +from TC_EWATERHTRBase import EWATERHTRBase from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main logger = logging.getLogger(__name__) @@ -48,19 +48,20 @@ def pics_TC_EWATERHTR_2_1(self): def steps_TC_EWATERHTR_2_1(self) -> list[TestStep]: steps = [ - TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2", "TH reads HeaterTypes attribute.", - "DUT as Server replies with a WaterHeaterTypeBitmap (enum8)greater than 0x00 (at least one type supported), and less than 0x20 (no undefined types supported)."), - TestStep("3", "TH reads HeatDemand attribute.", - "DUT as Server replies with a WaterHeaterDemandBitmap (enum8)."), - TestStep("4", "TH reads TankVolume attribute.", - "DUT as Server replies with a uint16 value."), + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads HeaterTypes attribute.", + "DUT as Server replies with a WaterHeaterTypeBitmap (enum8)greater than 0x00 (at least one type supported), and less than 0x20 (no undefined types supported)."), + TestStep("3", "TH reads HeatDemand attribute.", + "DUT as Server replies with a WaterHeaterDemandBitmap (enum8)."), + TestStep("4", "TH reads TankVolume attribute.", + "DUT as Server replies with a uint16 value."), TestStep("5", "TH reads EstimatedHeatRequired attribute.", - "DUT as Server replies with an energy-mWh value."), + "DUT as Server replies with an energy-mWh value."), TestStep("6", "TH reads TankPercentage attribute.", - "DUT as Server replies with a percent value."), + "DUT as Server replies with a percent value."), TestStep("7", "TH reads BoostState attribute.", - "DUT as Server replies with a BoostStateEnum (enum8) value."), + "DUT as Server replies with a BoostStateEnum (enum8) value."), ] return steps diff --git a/src/python_testing/TC_EWATERHTR_2_2.py b/src/python_testing/TC_EWATERHTR_2_2.py index 641b4e1f63759c..6f8ce36333098a 100644 --- a/src/python_testing/TC_EWATERHTR_2_2.py +++ b/src/python_testing/TC_EWATERHTR_2_2.py @@ -31,7 +31,7 @@ import time import chip.clusters as Clusters -from EWATERHTRBase import EWATERHTRBase +from TC_EWATERHTRBase import EWATERHTRBase from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts @@ -42,7 +42,7 @@ class TC_EWATERHTR_2_2(MatterBaseTest, EWATERHTRBase): def desc_TC_EWATERHTR_2_2(self) -> str: """Returns a description of this test""" - return "[TC-EWATERHTR-2.2] Basic functionality with attributes with DUT as Server\n" \ + return "[TC-EWATERHTR-2.2] Basic functionality with attributes with DUT as Server." \ "This test case verifies the primary functionality of the Water Heater Management cluster server." def pics_TC_EWATERHTR_2_2(self): @@ -51,71 +51,119 @@ def pics_TC_EWATERHTR_2_2(self): def steps_TC_EWATERHTR_2_2(self) -> list[TestStep]: steps = [ - TestStep("1", "Commissioning, already done", is_commissioning=True), + TestStep("1", "Commissioning, already done", + is_commissioning=True), TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.", - "Verify value is 1 (True)"), + "Verify value is 1 (True)"), TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event.", - "Verify Command response is Success"), + "Verify Command response is Success"), TestStep("3a", "TH reads HeatDemand attribute.", - "Verify value is 0x00 (no demand on any source)"), + "Verify value is 0x00 (no demand on any source)"), TestStep("3b", "TH reads BoostState attribute.", - "Verify value is 0 (Inactive)"), - TestStep( - "3c", "TH reads HeaterTypes attribute.", - "Verify value is greater than 0x00 (at least one type supported) and store the value as HeaterTypes"), + "Verify value is 0 (Inactive)"), + TestStep("3c", "TH reads HeaterTypes attribute.", + "Verify value is greater than 0x00 (at least one type supported) and store the value as HeaterTypes"), TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Manual mode Test Event.", - "Verify Command response is Success"), + "Verify Command response is Success"), TestStep("4a", "TH reads HeatDemand attribute.", - "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), - TestStep("5", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event. Verify Command response is Success"), - TestStep("5a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 20C Test Event. Verify Command response is Success"), - TestStep("6a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source)"), - TestStep("7", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Off mode Test Event. Verify Command response is Success"), - TestStep("7a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("8", "TH sends Boost with Duration=5s,OneShot=True. Verify Command response is Success"), - TestStep("8a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), - TestStep("8b", "TH reads BoostState attribute. Verify value is 1 (Active)"), + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("5", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event.", + "Verify Command response is Success"), + TestStep("5a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 20C Test Event.", + "Verify Command response is Success"), + TestStep("6a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source)"), + TestStep("7", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Off mode Test Event.", + "Verify Command response is Success"), + TestStep("7a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("8", "TH sends Boost with Duration=5s,OneShot=True.", + "Verify Command response is Success"), + TestStep("8a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("8b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), TestStep("9", "Wait 6 seconds"), - TestStep("9a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("9b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), - TestStep("10", "TH sends Boost with Duration=600s,OneShot=True. Verify Command response is Success"), - TestStep("10a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), - TestStep("10b", "TH reads BoostState attribute. Verify value is 1 (Active)"), - TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event. Verify Command response is Success"), - TestStep("11a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("11b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), - TestStep("12", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 20C Test Event. Verify Command response is Success"), - TestStep("12a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("13", "TH sends Boost with Duration=600s. Verify Command response is Success"), - TestStep("13a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), - TestStep("13b", "TH reads BoostState attribute. Verify value is 1 (Active)"), - TestStep("14", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event. Verify Command response is Success"), - TestStep("14a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("14b", "TH reads BoostState attribute. Verify value is 1 (Active)"), - TestStep("15", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 20C Test Event. Verify Command response is Success"), - TestStep("15a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), - TestStep("15b", "TH reads BoostState attribute. Verify value is 1 (Active)"), - TestStep("16", "TH sends CancelBoost. Verify Command response is Success"), - TestStep("16a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("16b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), - TestStep("17", "TH sends Boost with Duration=600s,TemporarySetpoint=65C. Verify Command response is Success"), - TestStep("17a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), - TestStep("17b", "TH reads BoostState attribute. Verify value is 1 (Active)"), - TestStep("18", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event. Verify Command response is Success"), - TestStep("18a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), - TestStep("18b", "TH reads BoostState attribute. Verify value is 1 (Active)"), - TestStep("19", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 66C Test Event. Verify Command response is Success"), - TestStep("19a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("19b", "TH reads BoostState attribute. Verify value is 1 (Active)"), - TestStep("20", "TH sends Boost with Duration=600s,TemporarySetpoint=70C. Verify Command response is Success"), - TestStep("20a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), - TestStep("20b", "TH reads BoostState attribute. Verify value is 1 (Active)"), - TestStep("21", "TH sends CancelBoost. Verify Command response is Success"), - TestStep("21a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("21b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), - TestStep("22", "TH sends CancelBoost. Verify Command response is Success"), - TestStep("23", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event Clear. Verify Command response is Success"), + TestStep("9a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("9b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), + TestStep("10", "TH sends Boost with Duration=600s,OneShot=True.", + "Verify Command response is Success"), + TestStep("10a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("10b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event.", + "Verify Command response is Success"), + TestStep("11a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("11b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), + TestStep("12", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 20C Test Event.", + "Verify Command response is Success"), + TestStep("12a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("13", "TH sends Boost with Duration=600s.", + "Verify Command response is Success"), + TestStep("13a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("13b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("14", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event.", + "Verify Command response is Success"), + TestStep("14a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("14b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("15", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 20C Test Event.", + "Verify Command response is Success"), + TestStep("15a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("15b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("16", "TH sends CancelBoost.", + "Verify Command response is Success"), + TestStep("16a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("16b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), + TestStep("17", "TH sends Boost with Duration=600s,TemporarySetpoint=65C.", + "Verify Command response is Success"), + TestStep("17a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("17b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("18", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event.", + "Verify Command response is Success"), + TestStep("18a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("18b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("19", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 66C Test Event.", + "Verify Command response is Success"), + TestStep("19a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("19b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("20", "TH sends Boost with Duration=600s,TemporarySetpoint=70C.", + "Verify Command response is Success"), + TestStep("20a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("20b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("21", "TH sends CancelBoost.", + "Verify Command response is Success"), + TestStep("21a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("21b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), + TestStep("22", "TH sends CancelBoost.", + "Verify Command response is Success"), + TestStep("23", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event Clear.", + "Verify Command response is Success"), ] return steps @@ -140,14 +188,16 @@ async def test_TC_EWATERHTR_2_2(self): self.step("3c") heaterTypes = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") - asserts.assert_equal(heaterTypes, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kImmersionElement1) + asserts.assert_equal( + heaterTypes, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kImmersionElement1) self.step("4") await self.send_test_event_trigger_manual_mode_test_event() self.step("4a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_not_equal( + heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) self.step("5") await self.send_test_event_trigger_water_temperature61C_test_event() @@ -161,7 +211,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("6a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_not_equal( + heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) self.step("7") await self.send_test_event_trigger_off_mode_test_event() @@ -175,7 +226,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("8a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_not_equal( + heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) self.step("8b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -195,7 +247,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("10a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_not_equal( + heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) self.step("10b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -222,7 +275,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("13a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_not_equal( + heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) self.step("13b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -242,7 +296,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("15a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_not_equal( + heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) self.step("15b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -262,7 +317,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("17a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_not_equal( + heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) self.step("17b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -272,7 +328,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("18a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_not_equal( + heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) self.step("18b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -292,7 +349,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("20a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_not_equal( + heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) self.step("20b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) diff --git a/src/python_testing/TC_EWATERHTR_2_3.py b/src/python_testing/TC_EWATERHTR_2_3.py index 2505ab67d3da7f..9110155423b656 100644 --- a/src/python_testing/TC_EWATERHTR_2_3.py +++ b/src/python_testing/TC_EWATERHTR_2_3.py @@ -29,7 +29,7 @@ import logging import chip.clusters as Clusters -from EWATERHTRBase import EWATERHTRBase +from TC_EWATERHTRBase import EWATERHTRBase from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts @@ -40,7 +40,7 @@ class TC_EWATERHTR_2_3(MatterBaseTest, EWATERHTRBase): def desc_TC_EWATERHTR_2_3(self) -> str: """Returns a description of this test""" - return "[TC-EWATERHTR-2.3] Attributes with attributes with DUT as Server\n" \ + return "[TC-EWATERHTR-2.3] Attributes with attributes with DUT as Server." \ "This test case verifies the functionality of the Water Heater Management cluster server with the TankPercentage feature." def pics_TC_EWATERHTR_2_3(self): @@ -49,50 +49,92 @@ def pics_TC_EWATERHTR_2_3(self): def steps_TC_EWATERHTR_2_3(self) -> list[TestStep]: steps = [ - TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify value is 1 (True)"), - TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event. Verify Command response is Success"), - TestStep("3a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("3b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), - TestStep("3c", "TH reads TankPercentage attribute. Verify value is 0%"), - TestStep( - "3d", "TH reads HeaterTypes attribute. Verify value is greater than 0x00 (at least one type supported) and {storeValueAs} HeaterTypes"), - TestStep("4", "TH sends Boost with Duration=600s,TargetPercentage=100%. Verify Command response is Success"), - TestStep("4a", "TH reads HeatDemand attribute. Verify value is 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 BoostState attribute. Verify value is 1 (Active)"), - TestStep("5", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event. Verify Command response is Success"), - TestStep("5a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("5b", "TH reads BoostState attribute. Verify value is 0 (Active)"), - TestStep("5c", "TH reads TankPercentage attribute. Verify value is 100%"), - TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Draw off hot water Test Event. Verify Command response is Success"), - TestStep("6a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), - TestStep("6b", "TH reads BoostState attribute. Verify value is 0 (Active)"), - TestStep("6c", "TH reads TankPercentage attribute. Verify value is 75%"), - TestStep("7", "TH sends CancelBoost. Verify Command response is Success"), - TestStep("7a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("7b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), - TestStep("7c", "TH reads TankPercentage attribute. Verify value is 75%"), - TestStep("8", "TH sends Boost with Duration=600s,TargetPercentage=100%,TargetReheat=65%. Verify Command response is Success"), - TestStep("8a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), - TestStep("8b", "TH reads BoostState attribute. Verify value is 1 (Active)"), - TestStep("8c", "TH reads TankPercentage attribute. Verify value is 75%"), - TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event. Verify Command response is Success"), - TestStep("9a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("9b", "TH reads BoostState attribute. Verify value is 1 (Active)"), - TestStep("9c", "TH reads TankPercentage attribute. Verify value is 100%"), - TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Draw off hot water Test Event. Verify Command response is Success"), - TestStep("10a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("10b", "TH reads BoostState attribute. Verify value is 1 (Active)"), - TestStep("10c", "TH reads TankPercentage attribute. Verify value is 75%"), - TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Draw off hot water Test Event. Verify Command response is Success"), - TestStep("11a", "TH reads HeatDemand attribute. Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), - TestStep("11b", "TH reads BoostState attribute. Verify value is 1 (Active)"), - TestStep("11c", "TH reads TankPercentage attribute. Verify value is 50%"), - TestStep("12", "TH sends CancelBoost. Verify Command response is Success"), - TestStep("12a", "TH reads HeatDemand attribute. Verify value is 0x00 (no demand on any source)"), - TestStep("12b", "TH reads BoostState attribute. Verify value is 0 (Inactive)"), - TestStep("12c", "TH reads TankPercentage attribute. Verify value is 50%"), - TestStep("13", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event Clear. Verify Command response is Success"), + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.", + "Verify value is 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event.", + "Verify Command response is Success"), + TestStep("3a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("3b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), + TestStep("3c", "TH reads TankPercentage attribute.", + "Verify value is 0%"), + TestStep("3d", "TH reads HeaterTypes attribute.", + "Verify value is greater than 0x00 (at least one type supported) and {storeValueAs} HeaterTypes"), + TestStep("4", "TH sends Boost with Duration=600s,TargetPercentage=100%.", + "Verify Command response is Success"), + TestStep("4a", "TH reads HeatDemand attribute.", + "Verify value is 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 BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("5", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event.", + "Verify Command response is Success"), + TestStep("5a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("5b", "TH reads BoostState attribute.", + "Verify value is 0 (Active)"), + TestStep("5c", "TH reads TankPercentage attribute.", + "Verify value is 100%"), + TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Draw off hot water Test Event.", + "Verify Command response is Success"), + TestStep("6a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("6b", "TH reads BoostState attribute.", + "Verify value is 0 (Active)"), + TestStep("6c", "TH reads TankPercentage attribute.", + "Verify value is 75%"), + TestStep("7", "TH sends CancelBoost.", + "Verify Command response is Success"), + TestStep("7a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("7b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), + TestStep("7c", "TH reads TankPercentage attribute.", + "Verify value is 75%"), + TestStep("8", "TH sends Boost with Duration=600s,TargetPercentage=100%,TargetReheat=65%.", + "Verify Command response is Success"), + TestStep("8a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("8b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("8c", "TH reads TankPercentage attribute.", + "Verify value is 75%"), + TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Water Temperature 61C Test Event.", + "Verify Command response is Success"), + TestStep("9a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("9b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("9c", "TH reads TankPercentage attribute.", + "Verify value is 100%"), + TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Draw off hot water Test Event.", + "Verify Command response is Success"), + TestStep("10a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("10b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("10c", "TH reads TankPercentage attribute.", + "Verify value is 75%"), + TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Draw off hot water Test Event.", + "Verify Command response is Success"), + TestStep("11a", "TH reads HeatDemand attribute.", + "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), + TestStep("11b", "TH reads BoostState attribute.", + "Verify value is 1 (Active)"), + TestStep("11c", "TH reads TankPercentage attribute.", + "Verify value is 50%"), + TestStep("12", "TH sends CancelBoost.", + "Verify Command response is Success"), + TestStep("12a", "TH reads HeatDemand attribute.", + "Verify value is 0x00 (no demand on any source)"), + TestStep("12b", "TH reads BoostState attribute.", + "Verify value is 0 (Inactive)"), + TestStep("12c", "TH reads TankPercentage attribute.", + "Verify value is 50%"), + TestStep("13", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Basic installation Test Event Clear.", + "Verify Command response is Success"), ] return steps @@ -120,14 +162,16 @@ async def test_TC_EWATERHTR_2_3(self): self.step("3d") heaterTypes = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") - asserts.assert_equal(heaterTypes, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kImmersionElement1) + asserts.assert_equal( + heaterTypes, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kImmersionElement1) self.step("4") await self.send_boost_command(duration=600, target_percentage=100) self.step("4a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_not_equal( + heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) self.step("4b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -150,7 +194,8 @@ async def test_TC_EWATERHTR_2_3(self): self.step("6a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_not_equal( + heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) self.step("6b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -175,7 +220,8 @@ async def test_TC_EWATERHTR_2_3(self): self.step("8a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_not_equal( + heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) self.step("8b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -212,7 +258,8 @@ async def test_TC_EWATERHTR_2_3(self): self.step("11a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal(heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_not_equal( + heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) self.step("11b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) From 1f34ebf057698d889b34d8db2dd12496c21478f3 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Thu, 25 Jul 2024 00:23:04 +0100 Subject: [PATCH 08/27] Restyle fix. --- src/python_testing/TC_EWATERHTR_2_1.py | 4 ++-- src/python_testing/TC_EWATERHTR_2_2.py | 2 +- src/python_testing/TC_EWATERHTR_2_3.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py index 497544ba7313f3..00402d2b97f42b 100644 --- a/src/python_testing/TC_EWATERHTR_2_1.py +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -29,8 +29,8 @@ import logging import chip.clusters as Clusters -from TC_EWATERHTRBase import EWATERHTRBase from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from TC_EWATERHTRBase import EWATERHTRBase logger = logging.getLogger(__name__) @@ -51,7 +51,7 @@ def steps_TC_EWATERHTR_2_1(self) -> list[TestStep]: TestStep("1", "Commissioning, already done", is_commissioning=True), TestStep("2", "TH reads HeaterTypes attribute.", - "DUT as Server replies with a WaterHeaterTypeBitmap (enum8)greater than 0x00 (at least one type supported), and less than 0x20 (no undefined types supported)."), + "DUT as Server replies with a WaterHeaterTypeBitmap (enum8) greater than 0x00 (at least one type supported), and less than 0x20 (no undefined types supported)."), TestStep("3", "TH reads HeatDemand attribute.", "DUT as Server replies with a WaterHeaterDemandBitmap (enum8)."), TestStep("4", "TH reads TankVolume attribute.", diff --git a/src/python_testing/TC_EWATERHTR_2_2.py b/src/python_testing/TC_EWATERHTR_2_2.py index 6f8ce36333098a..f4f64e24956fa7 100644 --- a/src/python_testing/TC_EWATERHTR_2_2.py +++ b/src/python_testing/TC_EWATERHTR_2_2.py @@ -31,9 +31,9 @@ import time import chip.clusters as Clusters -from TC_EWATERHTRBase import EWATERHTRBase from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts +from TC_EWATERHTRBase import EWATERHTRBase logger = logging.getLogger(__name__) diff --git a/src/python_testing/TC_EWATERHTR_2_3.py b/src/python_testing/TC_EWATERHTR_2_3.py index 9110155423b656..899dafe96bbf48 100644 --- a/src/python_testing/TC_EWATERHTR_2_3.py +++ b/src/python_testing/TC_EWATERHTR_2_3.py @@ -29,9 +29,9 @@ import logging import chip.clusters as Clusters -from TC_EWATERHTRBase import EWATERHTRBase from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts +from TC_EWATERHTRBase import EWATERHTRBase logger = logging.getLogger(__name__) From 10392f719907ee2314a5c59b53202ea06693f9c8 Mon Sep 17 00:00:00 2001 From: PeterC1965 <101805108+PeterC1965@users.noreply.github.com> Date: Thu, 25 Jul 2024 09:09:58 +0100 Subject: [PATCH 09/27] Update src/python_testing/TC_EWATERHTR_2_1.py Co-authored-by: jamesharrow <93921463+jamesharrow@users.noreply.github.com> --- src/python_testing/TC_EWATERHTR_2_1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py index 00402d2b97f42b..ec73268d5fbb98 100644 --- a/src/python_testing/TC_EWATERHTR_2_1.py +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -44,7 +44,7 @@ def desc_TC_EWATERHTR_2_1(self) -> str: def pics_TC_EWATERHTR_2_1(self): """ This function returns a list of PICS for this test case that must be True for the test to be run""" - return ["EWATERHTR.S", "EWATERHTR.S.F00", "EWATERHTR.S.F01"] + return ["EWATERHTR.S"] def steps_TC_EWATERHTR_2_1(self) -> list[TestStep]: steps = [ From 65615c2ba669bc13b85597e9d084357a2f26739a Mon Sep 17 00:00:00 2001 From: pcoleman Date: Thu, 25 Jul 2024 10:33:45 +0100 Subject: [PATCH 10/27] Start addressing review comments from JamesH --- src/python_testing/TC_EEVSE_2_4.py | 229 ------------------------- src/python_testing/TC_EWATERHTR_2_1.py | 42 ++++- src/python_testing/TC_EWATERHTR_2_2.py | 3 +- src/python_testing/TC_EWATERHTR_2_3.py | 2 +- 4 files changed, 36 insertions(+), 240 deletions(-) delete mode 100644 src/python_testing/TC_EEVSE_2_4.py diff --git a/src/python_testing/TC_EEVSE_2_4.py b/src/python_testing/TC_EEVSE_2_4.py deleted file mode 100644 index 73ec4e60ea4f35..00000000000000 --- a/src/python_testing/TC_EEVSE_2_4.py +++ /dev/null @@ -1,229 +0,0 @@ -# -# Copyright (c) 2023 Project CHIP Authors -# All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments -# for details about the block below. -# -# === BEGIN CI TEST ARGUMENTS === -# test-runner-runs: run1 -# test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} -# test-runner-run/run1/factoryreset: True -# test-runner-run/run1/quiet: True -# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f -# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto -# === END CI TEST ARGUMENTS === - - -import logging -import time - -import chip.clusters as Clusters -from chip.clusters.Types import NullValue -from matter_testing_support import EventChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main -from TC_EEVSE_Utils import EEVSEBaseTestHelper - -logger = logging.getLogger(__name__) - - -class TC_EEVSE_2_4(MatterBaseTest, EEVSEBaseTestHelper): - - def desc_TC_EEVSE_2_4(self) -> str: - """Returns a description of this test""" - return "5.1.5. [TC-EEVSE-2.4] Fault test functionality with DUT as Server" - - def pics_TC_EEVSE_2_4(self): - """ This function returns a list of PICS for this test case that must be True for the test to be run""" - # In this case - there is no feature flags needed to run this test case - return ["EEVSE.S"] - - def steps_TC_EEVSE_2_4(self) -> list[TestStep]: - steps = [ - TestStep("1", "Commissioning, already done", - is_commissioning=True), - TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster", - "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), - TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event"), - TestStep("3a", "After a few seconds TH reads from the DUT the State attribute", - "Verify value is 0x00 (NotPluggedIn)"), - TestStep("3b", "TH reads from the DUT the SupplyState attribute", - "Verify value is 0x00 (Disabled)"), - TestStep("3c", "TH reads from the DUT the FaultState attribute", - "Verify value is 0x00 (NoError)"), - TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event", - "Verify Event EEVSE.S.E00(EVConnected) sent"), - TestStep("4a", "TH reads from the DUT the State attribute", - "Verify value is 0x01 (PluggedInNoDemand)"), - TestStep("4b", - "TH reads from the DUT the SessionID attribute. Value is saved for later"), - TestStep("5", "TH sends command EnableCharging with ChargingEnabledUntil=Null, minimumChargeCurrent=6000, maximumChargeCurrent=60000"), - TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event", - "Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), - TestStep("6a", "TH reads from the DUT the State attribute", - "Verify value is 0x3 (PluggedInCharging)"), - TestStep("6b", "TH reads from the DUT the SupplyState attribute", - "Verify value is 0x1 (ChargingEnabled)"), - TestStep("7", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Ground Fault Test Event", - "Verify Event EEVSE.S.E04(Fault) sent with SessionID matching value in step 4b, FaultStatePreviousFaultState = 0x00 (NoError), FaultStateCurrentFaultState = 0x07 (GroundFault)"), - TestStep("7a", "TH reads from the DUT the State attribute", - "Verify value is 0x6 (Fault)"), - TestStep("7b", "TH reads from the DUT the SupplyState attribute", - "Verify value is 0x4 (DisabledError)"), - TestStep("8", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Over Temperature Fault Test Event", - "Verify Event EEVSE.S.E04(Fault) sent with SessionID matching value in step 4b, FaultStatePreviousFaultState = 0x07 (GroundFault), FaultStateCurrentFaultState = 0x0F (OverTemperature)"), - TestStep("8a", "TH reads from the DUT the State attribute", - "Verify value is 0x6 (Fault)"), - TestStep("8b", "TH reads from the DUT the SupplyState attribute", - "Verify value is 0x4 (DisabledError)"), - TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Fault Test Event Clear", - "Verify Event EEVSE.S.E04(Fault) sent with SessionID matching value in step 4b, FaultStatePreviousFaultState = 0x0F (OverTemperature), FaultStateCurrentFaultState = 0x00 (NoError)"), - TestStep("9a", "TH reads from the DUT the State attribute", - "Verify value is 0x3 (PluggedInCharging)"), - TestStep("9b", "TH reads from the DUT the SupplyState attribute", - "Verify value is 0x1 (ChargingEnabled)"), - TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear."), - TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event Clear", - "Verify Event EEVSE.S.E01(EVNotDetected) sent"), - TestStep("12", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event Clear."), - ] - - return steps - - @async_test_body - async def test_TC_EEVSE_2_4(self): - self.step("1") - # Commission DUT - already done - - # Subscribe to Events and when they are sent push them to a queue for checking later - events_callback = EventChangeCallback(Clusters.EnergyEvse) - await events_callback.start(self.default_controller, - self.dut_node_id, - self.matter_test_config.endpoint) - - self.step("2") - await self.check_test_event_triggers_enabled() - - self.step("3") - await self.send_test_event_trigger_basic() - - # After a few seconds... - time.sleep(3) - - self.step("3a") - await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) - - self.step("3b") - await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) - - self.step("3c") - await self.check_evse_attribute("FaultState", Clusters.EnergyEvse.Enums.FaultStateEnum.kNoError) - - self.step("4") - await self.send_test_event_trigger_pluggedin() - event_data = events_callback.wait_for_event_report( - Clusters.EnergyEvse.Events.EVConnected) - - self.step("4a") - await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand) - - self.step("4b") - # Save Session ID for later and check it against the value in the event - session_id = await self.read_evse_attribute_expect_success(attribute="SessionID") - self.validate_ev_connected_event(event_data, session_id) - - self.step("5") - charge_until = NullValue - min_charge_current = 6000 - max_charge_current = 60000 - await self.send_enable_charge_command(charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) - - self.step("6") - await self.send_test_event_trigger_charge_demand() - event_data = events_callback.wait_for_event_report( - Clusters.EnergyEvse.Events.EnergyTransferStarted) - - self.step("6a") - await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) - - self.step("6b") - await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kChargingEnabled) - - self.step("7") - await self.send_test_event_trigger_evse_ground_fault() - event_data = events_callback.wait_for_event_report( - Clusters.EnergyEvse.Events.Fault) - expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging - previous_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kNoError - current_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kGroundFault - self.validate_evse_fault_event( - event_data, session_id, expected_state, previous_fault, current_fault) - - self.step("7a") - await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kFault) - - self.step("7b") - await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabledError) - - self.step("8") - await self.send_test_event_trigger_evse_over_temperature_fault() - event_data = events_callback.wait_for_event_report( - Clusters.EnergyEvse.Events.Fault) - expected_state = Clusters.EnergyEvse.Enums.StateEnum.kFault - previous_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kGroundFault - current_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kOverTemperature - self.validate_evse_fault_event( - event_data, session_id, expected_state, previous_fault, current_fault) - - self.step("8a") - await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kFault) - - self.step("8b") - await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabledError) - - self.step("9") - await self.send_test_event_trigger_evse_fault_clear() - event_data = events_callback.wait_for_event_report( - Clusters.EnergyEvse.Events.Fault) - expected_state = Clusters.EnergyEvse.Enums.StateEnum.kFault - previous_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kOverTemperature - current_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kNoError - self.validate_evse_fault_event( - event_data, session_id, expected_state, previous_fault, current_fault) - - self.step("9a") - await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) - - self.step("9b") - await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kChargingEnabled) - - self.step("10") - await self.send_test_event_trigger_charge_demand_clear() - event_data = events_callback.wait_for_event_report( - Clusters.EnergyEvse.Events.EnergyTransferStopped) - - self.step("11") - await self.send_test_event_trigger_pluggedin_clear() - event_data = events_callback.wait_for_event_report( - Clusters.EnergyEvse.Events.EVNotDetected) - expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand - self.validate_ev_not_detected_event( - event_data, session_id, expected_state, expected_duration=0, expected_charged=0) - - self.step("12") - await self.send_test_event_trigger_basic_clear() - - -if __name__ == "__main__": - default_matter_test_main() diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py index ec73268d5fbb98..546be62dbf2870 100644 --- a/src/python_testing/TC_EWATERHTR_2_1.py +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -19,18 +19,19 @@ # for details about the block below. # # === BEGIN CI TEST ARGUMENTS ===# test-runner-runs: run1 -# test-runner-run/run1/app: ${WATER_HEATER_MANAGEMENT_APP} +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x03 -# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --int-arg PIXIT.EWATERHTR.EM:1 PIXIT.EWATERHTR.TP:2 # === END CI TEST ARGUMENTS === import logging import chip.clusters as Clusters -from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from TC_EWATERHTRBase import EWATERHTRBase +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts logger = logging.getLogger(__name__) @@ -69,24 +70,47 @@ def steps_TC_EWATERHTR_2_1(self) -> list[TestStep]: @async_test_body async def test_TC_EWATERHTR_2_1(self): + em_supported = self.matter_test_config.global_test_params['PIXIT.EWATERHTR.EM'] + tp_supported = self.matter_test_config.global_test_params['PIXIT.EWATERHTR.TP'] + self.step("1") # Commission DUT - already done - # Note the values used here are configured in WhmManufacturer::Init() self.step("2") - await self.check_whm_attribute("HeaterTypes", 0) + value = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") + asserts.assert_greater_equal(value, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kImmersionElement1, + f"Unexpected HeaterTypes value - expected {value} >= WaterHeaterTypeBitmap..kImmersionElement1") + asserts.assert_less_equal(value, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kOther, + f"Unexpected HeaterTypes value - expected {value} <= WaterHeaterTypeBitmap.kOther") self.step("3") - await self.check_whm_attribute("HeatDemand", 0) + value = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater_equal(value, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, + f"Unexpected HeatDemand value - expected {value} >= WaterHeaterDemandBitmap.kImmersionElement1") + asserts.assert_less_equal(value, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kOther, + f"Unexpected HeatDemand value - expected {value} <= WaterHeaterDemandBitmap.kOther") self.step("4") - await self.check_whm_attribute("TankVolume", 0) + if em_supported: + value = await self.read_whm_attribute_expect_success(attribute="TankVolume") + asserts.assert_greater_equal(value, 0, f"Unexpected TankVolume value - expected {value} >= 0") + else: + logging.info("Skipping step 2c as PIXIT.EWATERHTR.EM not supported") self.step("5") - await self.check_whm_attribute("EstimatedHeatRequired", 0) + if em_supported: + value = await self.read_whm_attribute_expect_success(attribute="EstimatedHeatRequired") + asserts.assert_greater_equal(value, 0, f"Unexpected EstimatedHeatRequired value - expected {value} >= 0") + else: + logging.info("Skipping step 2d as PIXIT.EWATERHTR.EM not supported") self.step("6") - await self.check_whm_attribute("TankPercentage", 0) + if tp_supported: + value = await self.read_whm_attribute_expect_success(attribute="TankPercentage") + asserts.assert_greater_equal(value, 0, f"Unexpected TankPercentage value - expected {value} >= 0") + asserts.assert_less_equal(value, 100, f"Unexpected TankPercentage value - expected {value} <= 100") + else: + logging.info("Skipping step 2e as PIXIT.EWATERHTR.TP not supported") self.step("7") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) diff --git a/src/python_testing/TC_EWATERHTR_2_2.py b/src/python_testing/TC_EWATERHTR_2_2.py index f4f64e24956fa7..f2791c105da0b6 100644 --- a/src/python_testing/TC_EWATERHTR_2_2.py +++ b/src/python_testing/TC_EWATERHTR_2_2.py @@ -19,7 +19,7 @@ # for details about the block below. # # === BEGIN CI TEST ARGUMENTS ===# test-runner-runs: run1 -# test-runner-run/run1/app: ${WATER_HEATER_MANAGEMENT_APP} +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x00 @@ -31,6 +31,7 @@ import time import chip.clusters as Clusters +from TC_EWATERHTRBase import EWATERHTRBase from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts from TC_EWATERHTRBase import EWATERHTRBase diff --git a/src/python_testing/TC_EWATERHTR_2_3.py b/src/python_testing/TC_EWATERHTR_2_3.py index 899dafe96bbf48..ad20d4cda6021f 100644 --- a/src/python_testing/TC_EWATERHTR_2_3.py +++ b/src/python_testing/TC_EWATERHTR_2_3.py @@ -18,7 +18,7 @@ # for details about the block below. # # === BEGIN CI TEST ARGUMENTS ===# test-runner-runs: run1 -# test-runner-run/run1/app: ${WATER_HEATER_MANAGEMENT_APP} +# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f --featureSet 0x03 From e69d58f14dec5ee6f277c8a55682607b609083f6 Mon Sep 17 00:00:00 2001 From: pcoleman Date: Thu, 25 Jul 2024 10:37:14 +0100 Subject: [PATCH 11/27] Remove water heater management app --- scripts/tests/py/test_metadata.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/tests/py/test_metadata.py b/scripts/tests/py/test_metadata.py index 491b4aff40cd72..863add965c315e 100644 --- a/scripts/tests/py/test_metadata.py +++ b/scripts/tests/py/test_metadata.py @@ -38,7 +38,6 @@ class TestMetadataReader(unittest.TestCase): ALL_CLUSTERS_APP: out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app CHIP_LOCK_APP: out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app ENERGY_MANAGEMENT_APP: out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app - WATER_HEATER_MANAGEMENT_APP: out/linux-x64-water-heater-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-water-heater-management-app TRACE_APP: out/trace_data/app-{SCRIPT_BASE_NAME} TRACE_TEST_JSON: out/trace_data/test-{SCRIPT_BASE_NAME} TRACE_TEST_PERFETTO: out/trace_data/test-{SCRIPT_BASE_NAME} From 97a3ec2eb13bf504a2a5ff4f8f10d28a40eb53b4 Mon Sep 17 00:00:00 2001 From: pcoleman Date: Thu, 25 Jul 2024 11:07:00 +0100 Subject: [PATCH 12/27] Address review comments from JamesH --- src/python_testing/TC_EWATERHTR_2_1.py | 20 ++++++------- src/python_testing/TC_EWATERHTR_2_2.py | 40 +++++++++++++------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py index 546be62dbf2870..fd3d076cced93b 100644 --- a/src/python_testing/TC_EWATERHTR_2_1.py +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -77,18 +77,18 @@ async def test_TC_EWATERHTR_2_1(self): # Commission DUT - already done self.step("2") - value = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") - asserts.assert_greater_equal(value, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kImmersionElement1, - f"Unexpected HeaterTypes value - expected {value} >= WaterHeaterTypeBitmap..kImmersionElement1") - asserts.assert_less_equal(value, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kOther, - f"Unexpected HeaterTypes value - expected {value} <= WaterHeaterTypeBitmap.kOther") + heater_types = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") + asserts.assert_greater(heater_types, 0, + f"Unexpected HeaterTypes value - expected {heater_types} > 0") + asserts.assert_less_equal(heater_types, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kOther, + f"Unexpected HeaterTypes value - expected {heater_types} <= WaterHeaterTypeBitmap.kOther") self.step("3") - value = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_greater_equal(value, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, - f"Unexpected HeatDemand value - expected {value} >= WaterHeaterDemandBitmap.kImmersionElement1") - asserts.assert_less_equal(value, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kOther, - f"Unexpected HeatDemand value - expected {value} <= WaterHeaterDemandBitmap.kOther") + heat_demand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heat_demand, 0, + f"Unexpected HeatDemand value - expected {heat_demand} > 0") + asserts.assert_less_equal(heat_demand, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kOther, + f"Unexpected HeatDemand value - expected {heat_demand} <= WaterHeaterDemandBitmap.kOther") self.step("4") if em_supported: diff --git a/src/python_testing/TC_EWATERHTR_2_2.py b/src/python_testing/TC_EWATERHTR_2_2.py index f2791c105da0b6..fbe181a382f098 100644 --- a/src/python_testing/TC_EWATERHTR_2_2.py +++ b/src/python_testing/TC_EWATERHTR_2_2.py @@ -188,17 +188,18 @@ async def test_TC_EWATERHTR_2_2(self): await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) self.step("3c") - heaterTypes = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") - asserts.assert_equal( - heaterTypes, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kImmersionElement1) + heater_types = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") + asserts.assert_greater(heater_types, 0, + f"Unexpected HeaterTypes value - expected {heater_types} > 0") + asserts.assert_less_equal(heater_types, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kOther, + f"Unexpected HeaterTypes value - expected {heater_types} <= WaterHeaterTypeBitmap.kOther") self.step("4") await self.send_test_event_trigger_manual_mode_test_event() self.step("4a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal( - heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_greater(heatDemand, 0) self.step("5") await self.send_test_event_trigger_water_temperature61C_test_event() @@ -212,8 +213,7 @@ async def test_TC_EWATERHTR_2_2(self): self.step("6a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal( - heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_greater(heatDemand, 0) self.step("7") await self.send_test_event_trigger_off_mode_test_event() @@ -226,9 +226,9 @@ async def test_TC_EWATERHTR_2_2(self): await self.send_boost_command(duration=5, one_shot=True) self.step("8a") - heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal( - heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + heat_demand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heat_demand, 0) + asserts.assert_equal(heat_demand & (~heater_types), 0, "heat_demand should only be from declared supported types"), self.step("8b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -248,8 +248,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("10a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal( - heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_greater(heat_demand, 0) + asserts.assert_equal(heat_demand & (~heater_types), 0, "heat_demand should only be from declared supported types"), self.step("10b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -276,8 +276,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("13a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal( - heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_greater(heat_demand, 0) + asserts.assert_equal(heat_demand & (~heater_types), 0, "heat_demand should only be from declared supported types"), self.step("13b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -297,8 +297,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("15a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal( - heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_greater(heat_demand, 0) + asserts.assert_equal(heat_demand & (~heater_types), 0, "heat_demand should only be from declared supported types"), self.step("15b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -318,8 +318,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("17a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal( - heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_greater(heat_demand, 0) + asserts.assert_equal(heat_demand & (~heater_types), 0, "heat_demand should only be from declared supported types"), self.step("17b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -350,8 +350,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("20a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal( - heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_greater(heat_demand, 0) + asserts.assert_equal(heat_demand & (~heater_types), 0, "heat_demand should only be from declared supported types"), self.step("20b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) From bdb8cc6b5e77179b53f4f8df30c2b6d5d4d61e55 Mon Sep 17 00:00:00 2001 From: pcoleman Date: Thu, 25 Jul 2024 11:57:19 +0100 Subject: [PATCH 13/27] Address review comments from JamesH --- src/python_testing/TC_EWATERHTR_2_1.py | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py index fd3d076cced93b..4eb6224cd93c0f 100644 --- a/src/python_testing/TC_EWATERHTR_2_1.py +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -77,32 +77,32 @@ async def test_TC_EWATERHTR_2_1(self): # Commission DUT - already done self.step("2") - heater_types = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") - asserts.assert_greater(heater_types, 0, - f"Unexpected HeaterTypes value - expected {heater_types} > 0") - asserts.assert_less_equal(heater_types, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kOther, - f"Unexpected HeaterTypes value - expected {heater_types} <= WaterHeaterTypeBitmap.kOther") + heaterTypes = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") + asserts.assert_greater(heaterTypes, 0, + f"Unexpected HeaterTypes value - expected {heaterTypes} > 0") + asserts.assert_less_equal(heaterTypes, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kOther, + f"Unexpected HeaterTypes value - expected {heaterTypes} <= WaterHeaterTypeBitmap.kOther") self.step("3") - heat_demand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_greater(heat_demand, 0, - f"Unexpected HeatDemand value - expected {heat_demand} > 0") - asserts.assert_less_equal(heat_demand, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kOther, - f"Unexpected HeatDemand value - expected {heat_demand} <= WaterHeaterDemandBitmap.kOther") + heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") + asserts.assert_greater(heatDemand, 0, + f"Unexpected HeatDemand value - expected {heatDemand} > 0") + asserts.assert_less_equal(heatDemand, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kOther, + f"Unexpected HeatDemand value - expected {heatDemand} <= WaterHeaterDemandBitmap.kOther") self.step("4") if em_supported: value = await self.read_whm_attribute_expect_success(attribute="TankVolume") asserts.assert_greater_equal(value, 0, f"Unexpected TankVolume value - expected {value} >= 0") else: - logging.info("Skipping step 2c as PIXIT.EWATERHTR.EM not supported") + logging.info("Skipping step 4 as PIXIT.EWATERHTR.EM not supported") self.step("5") if em_supported: value = await self.read_whm_attribute_expect_success(attribute="EstimatedHeatRequired") - asserts.assert_greater_equal(value, 0, f"Unexpected EstimatedHeatRequired value - expected {value} >= 0") + asserts.assert_greater(value, 0, f"Unexpected EstimatedHeatRequired value - expected {value} > 0") else: - logging.info("Skipping step 2d as PIXIT.EWATERHTR.EM not supported") + logging.info("Skipping step 5 as PIXIT.EWATERHTR.EM not supported") self.step("6") if tp_supported: @@ -110,7 +110,7 @@ async def test_TC_EWATERHTR_2_1(self): asserts.assert_greater_equal(value, 0, f"Unexpected TankPercentage value - expected {value} >= 0") asserts.assert_less_equal(value, 100, f"Unexpected TankPercentage value - expected {value} <= 100") else: - logging.info("Skipping step 2e as PIXIT.EWATERHTR.TP not supported") + logging.info("Skipping step 6 as PIXIT.EWATERHTR.TP not supported") self.step("7") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) From 2d9516b1dbd13684be3ba632f933bef594829689 Mon Sep 17 00:00:00 2001 From: pcoleman Date: Thu, 25 Jul 2024 12:03:24 +0100 Subject: [PATCH 14/27] Address review comments from JamesH --- .github/workflows/tests.yaml | 1 - src/python_testing/TC_EWATERHTR_2_2.py | 37 +++++++++++++------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d501bbc64a7c57..d559612d2be60d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -485,7 +485,6 @@ jobs: echo "ALL_CLUSTERS_APP: out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app" >> /tmp/test_env.yaml echo "CHIP_LOCK_APP: out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app" >> /tmp/test_env.yaml echo "ENERGY_MANAGEMENT_APP: out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app" >> /tmp/test_env.yaml - echo "WATER_HEATER_MANAGEMENT_APP: out/linux-x64-water-heater-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-water-heater-management-app" >> /tmp/test_env.yaml echo "LIT_ICD_APP: out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app" >> /tmp/test_env.yaml echo "CHIP_MICROWAVE_OVEN_APP: out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app" >> /tmp/test_env.yaml echo "CHIP_RVC_APP: out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app" >> /tmp/test_env.yaml diff --git a/src/python_testing/TC_EWATERHTR_2_2.py b/src/python_testing/TC_EWATERHTR_2_2.py index fbe181a382f098..a618bd950a4a76 100644 --- a/src/python_testing/TC_EWATERHTR_2_2.py +++ b/src/python_testing/TC_EWATERHTR_2_2.py @@ -188,11 +188,11 @@ async def test_TC_EWATERHTR_2_2(self): await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) self.step("3c") - heater_types = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") - asserts.assert_greater(heater_types, 0, - f"Unexpected HeaterTypes value - expected {heater_types} > 0") - asserts.assert_less_equal(heater_types, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kOther, - f"Unexpected HeaterTypes value - expected {heater_types} <= WaterHeaterTypeBitmap.kOther") + heaterTypes = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") + asserts.assert_greater(heaterTypes, 0, + f"Unexpected HeaterTypes value - expected {heaterTypes} > 0") + asserts.assert_less_equal(heaterTypes, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kOther, + f"Unexpected HeaterTypes value - expected {heaterTypes} <= WaterHeaterTypeBitmap.kOther") self.step("4") await self.send_test_event_trigger_manual_mode_test_event() @@ -200,6 +200,7 @@ async def test_TC_EWATERHTR_2_2(self): self.step("4a") 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("5") await self.send_test_event_trigger_water_temperature61C_test_event() @@ -226,9 +227,9 @@ async def test_TC_EWATERHTR_2_2(self): await self.send_boost_command(duration=5, one_shot=True) self.step("8a") - heat_demand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_greater(heat_demand, 0) - asserts.assert_equal(heat_demand & (~heater_types), 0, "heat_demand should only be from declared supported types"), + 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") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -248,8 +249,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("10a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_greater(heat_demand, 0) - asserts.assert_equal(heat_demand & (~heater_types), 0, "heat_demand should only be from declared supported types"), + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), self.step("10b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -276,8 +277,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("13a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_greater(heat_demand, 0) - asserts.assert_equal(heat_demand & (~heater_types), 0, "heat_demand should only be from declared supported types"), + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), self.step("13b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -297,8 +298,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("15a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_greater(heat_demand, 0) - asserts.assert_equal(heat_demand & (~heater_types), 0, "heat_demand should only be from declared supported types"), + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), self.step("15b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -318,8 +319,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("17a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_greater(heat_demand, 0) - asserts.assert_equal(heat_demand & (~heater_types), 0, "heat_demand should only be from declared supported types"), + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), self.step("17b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -350,8 +351,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("20a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_greater(heat_demand, 0) - asserts.assert_equal(heat_demand & (~heater_types), 0, "heat_demand should only be from declared supported types"), + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), self.step("20b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) From 0ce60d5477d8622a6464c4442999a235de117dfc Mon Sep 17 00:00:00 2001 From: pcoleman Date: Thu, 25 Jul 2024 12:07:50 +0100 Subject: [PATCH 15/27] Address review comments from JamesH --- src/python_testing/TC_EWATERHTR_2_2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/python_testing/TC_EWATERHTR_2_2.py b/src/python_testing/TC_EWATERHTR_2_2.py index a618bd950a4a76..78d8e8beb6d513 100644 --- a/src/python_testing/TC_EWATERHTR_2_2.py +++ b/src/python_testing/TC_EWATERHTR_2_2.py @@ -215,6 +215,7 @@ async def test_TC_EWATERHTR_2_2(self): self.step("6a") 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("7") await self.send_test_event_trigger_off_mode_test_event() @@ -330,8 +331,8 @@ async def test_TC_EWATERHTR_2_2(self): self.step("18a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal( - heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), self.step("18b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) From 06026e585cd3260db174a63d40edaa4266877725 Mon Sep 17 00:00:00 2001 From: PeterC1965 <101805108+PeterC1965@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:10:07 +0100 Subject: [PATCH 16/27] Update src/python_testing/TC_EWATERHTR_2_3.py Co-authored-by: jamesharrow <93921463+jamesharrow@users.noreply.github.com> --- src/python_testing/TC_EWATERHTR_2_3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_EWATERHTR_2_3.py b/src/python_testing/TC_EWATERHTR_2_3.py index ad20d4cda6021f..736d9a32446309 100644 --- a/src/python_testing/TC_EWATERHTR_2_3.py +++ b/src/python_testing/TC_EWATERHTR_2_3.py @@ -40,7 +40,7 @@ class TC_EWATERHTR_2_3(MatterBaseTest, EWATERHTRBase): def desc_TC_EWATERHTR_2_3(self) -> str: """Returns a description of this test""" - return "[TC-EWATERHTR-2.3] Attributes with attributes with DUT as Server." \ + return "[TC-EWATERHTR-2.3] This test case verifies the functionality of the Water Heater Management cluster server with the TankPercentage feature."``` "This test case verifies the functionality of the Water Heater Management cluster server with the TankPercentage feature." def pics_TC_EWATERHTR_2_3(self): From a418517d3c691bde234bd915479bb2412f8484b5 Mon Sep 17 00:00:00 2001 From: PeterC1965 <101805108+PeterC1965@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:10:21 +0100 Subject: [PATCH 17/27] Update src/python_testing/TC_EWATERHTR_2_3.py Co-authored-by: jamesharrow <93921463+jamesharrow@users.noreply.github.com> --- src/python_testing/TC_EWATERHTR_2_3.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/python_testing/TC_EWATERHTR_2_3.py b/src/python_testing/TC_EWATERHTR_2_3.py index 736d9a32446309..6f6fe10e152b7a 100644 --- a/src/python_testing/TC_EWATERHTR_2_3.py +++ b/src/python_testing/TC_EWATERHTR_2_3.py @@ -41,7 +41,6 @@ class TC_EWATERHTR_2_3(MatterBaseTest, EWATERHTRBase): def desc_TC_EWATERHTR_2_3(self) -> str: """Returns a description of this test""" return "[TC-EWATERHTR-2.3] This test case verifies the functionality of the Water Heater Management cluster server with the TankPercentage feature."``` - "This test case verifies the functionality of the Water Heater Management cluster server with the TankPercentage feature." def pics_TC_EWATERHTR_2_3(self): """ This function returns a list of PICS for this test case that must be True for the test to be run""" From 86a70907a7d19e1b591e732cf40f19a31f562edc Mon Sep 17 00:00:00 2001 From: PeterC1965 <101805108+PeterC1965@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:10:47 +0100 Subject: [PATCH 18/27] Update src/python_testing/TC_EWATERHTR_2_3.py Co-authored-by: jamesharrow <93921463+jamesharrow@users.noreply.github.com> --- src/python_testing/TC_EWATERHTR_2_3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_EWATERHTR_2_3.py b/src/python_testing/TC_EWATERHTR_2_3.py index 6f6fe10e152b7a..9d0d46ae4dacc6 100644 --- a/src/python_testing/TC_EWATERHTR_2_3.py +++ b/src/python_testing/TC_EWATERHTR_2_3.py @@ -61,7 +61,7 @@ def steps_TC_EWATERHTR_2_3(self) -> list[TestStep]: TestStep("3c", "TH reads TankPercentage attribute.", "Verify value is 0%"), TestStep("3d", "TH reads HeaterTypes attribute.", - "Verify value is greater than 0x00 (at least one type supported) and {storeValueAs} HeaterTypes"), + "Verify value is greater than 0x00 (at least one type supported) and store the value as HeaterTypes"), TestStep("4", "TH sends Boost with Duration=600s,TargetPercentage=100%.", "Verify Command response is Success"), TestStep("4a", "TH reads HeatDemand attribute.", From 774bd7ba21ffb20079e5eca97a0a3cf7a887e3b4 Mon Sep 17 00:00:00 2001 From: PeterC1965 <101805108+PeterC1965@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:11:59 +0100 Subject: [PATCH 19/27] Update src/python_testing/TC_EWATERHTR_2_3.py Co-authored-by: jamesharrow <93921463+jamesharrow@users.noreply.github.com> --- src/python_testing/TC_EWATERHTR_2_3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_EWATERHTR_2_3.py b/src/python_testing/TC_EWATERHTR_2_3.py index 9d0d46ae4dacc6..ad3e1aa8781a1c 100644 --- a/src/python_testing/TC_EWATERHTR_2_3.py +++ b/src/python_testing/TC_EWATERHTR_2_3.py @@ -73,7 +73,7 @@ def steps_TC_EWATERHTR_2_3(self) -> list[TestStep]: TestStep("5a", "TH reads HeatDemand attribute.", "Verify value is 0x00 (no demand on any source)"), TestStep("5b", "TH reads BoostState attribute.", - "Verify value is 0 (Active)"), + "Verify value is 1 (Active)"), TestStep("5c", "TH reads TankPercentage attribute.", "Verify value is 100%"), TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EWATERHTR.TEST_EVENT_TRIGGER for Draw off hot water Test Event.", From 2f0eee7b60d3a7301a55808947cc62f6ef2f9fc6 Mon Sep 17 00:00:00 2001 From: PeterC1965 <101805108+PeterC1965@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:12:12 +0100 Subject: [PATCH 20/27] Update src/python_testing/TC_EWATERHTR_2_3.py Co-authored-by: jamesharrow <93921463+jamesharrow@users.noreply.github.com> --- src/python_testing/TC_EWATERHTR_2_3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_EWATERHTR_2_3.py b/src/python_testing/TC_EWATERHTR_2_3.py index ad3e1aa8781a1c..be52ce38aa96d2 100644 --- a/src/python_testing/TC_EWATERHTR_2_3.py +++ b/src/python_testing/TC_EWATERHTR_2_3.py @@ -81,7 +81,7 @@ def steps_TC_EWATERHTR_2_3(self) -> list[TestStep]: TestStep("6a", "TH reads HeatDemand attribute.", "Verify value is greater than 0x00 (demand on at least one source) and (HeaterDemand & (!HeaterTypes)) is zero (demand is only from declared supported types)"), TestStep("6b", "TH reads BoostState attribute.", - "Verify value is 0 (Active)"), + "Verify value is 1 (Active)"), TestStep("6c", "TH reads TankPercentage attribute.", "Verify value is 75%"), TestStep("7", "TH sends CancelBoost.", From 2ac5dadd55d7ff7aec60bd964dd16e9c0ef48a5c Mon Sep 17 00:00:00 2001 From: pcoleman Date: Thu, 25 Jul 2024 12:17:22 +0100 Subject: [PATCH 21/27] Address review comments from JamesH --- src/python_testing/TC_EWATERHTR_2_3.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/python_testing/TC_EWATERHTR_2_3.py b/src/python_testing/TC_EWATERHTR_2_3.py index be52ce38aa96d2..b9572c9520d843 100644 --- a/src/python_testing/TC_EWATERHTR_2_3.py +++ b/src/python_testing/TC_EWATERHTR_2_3.py @@ -40,7 +40,7 @@ class TC_EWATERHTR_2_3(MatterBaseTest, EWATERHTRBase): def desc_TC_EWATERHTR_2_3(self) -> str: """Returns a description of this test""" - return "[TC-EWATERHTR-2.3] This test case verifies the functionality of the Water Heater Management cluster server with the TankPercentage feature."``` + return "[TC-EWATERHTR-2.3] This test case verifies the functionality of the Water Heater Management cluster server with the TankPercentage feature." def pics_TC_EWATERHTR_2_3(self): """ This function returns a list of PICS for this test case that must be True for the test to be run""" @@ -161,16 +161,15 @@ async def test_TC_EWATERHTR_2_3(self): self.step("3d") heaterTypes = await self.read_whm_attribute_expect_success(attribute="HeaterTypes") - asserts.assert_equal( - heaterTypes, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterTypeBitmap.kImmersionElement1) + asserts.assert_greater(heaterTypes, 0) self.step("4") await self.send_boost_command(duration=600, target_percentage=100) self.step("4a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal( - heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), self.step("4b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -193,8 +192,8 @@ async def test_TC_EWATERHTR_2_3(self): self.step("6a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal( - heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), self.step("6b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -219,8 +218,8 @@ async def test_TC_EWATERHTR_2_3(self): self.step("8a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal( - heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), self.step("8b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) @@ -257,8 +256,8 @@ async def test_TC_EWATERHTR_2_3(self): self.step("11a") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") - asserts.assert_not_equal( - heatDemand & Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kImmersionElement1, 0) + asserts.assert_greater(heatDemand, 0) + asserts.assert_equal(heatDemand & (~heaterTypes), 0, "heatDemand should only be from declared supported types"), self.step("11b") await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kActive) From dda26fe9c68315537070781d9431bb32decbc0bf Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 25 Jul 2024 11:18:10 +0000 Subject: [PATCH 22/27] Restyled by autopep8 --- src/python_testing/TC_EWATERHTR_2_1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py index 4eb6224cd93c0f..060f06f14e33a3 100644 --- a/src/python_testing/TC_EWATERHTR_2_1.py +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -86,7 +86,7 @@ async def test_TC_EWATERHTR_2_1(self): self.step("3") heatDemand = await self.read_whm_attribute_expect_success(attribute="HeatDemand") asserts.assert_greater(heatDemand, 0, - f"Unexpected HeatDemand value - expected {heatDemand} > 0") + f"Unexpected HeatDemand value - expected {heatDemand} > 0") asserts.assert_less_equal(heatDemand, Clusters.WaterHeaterManagement.Bitmaps.WaterHeaterDemandBitmap.kOther, f"Unexpected HeatDemand value - expected {heatDemand} <= WaterHeaterDemandBitmap.kOther") From 0df10cb11af6e6d93d7e55918ceaf888e058f48d Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 25 Jul 2024 11:18:11 +0000 Subject: [PATCH 23/27] Restyled by isort --- src/python_testing/TC_EWATERHTR_2_1.py | 2 +- src/python_testing/TC_EWATERHTR_2_2.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py index 060f06f14e33a3..60908caa075fbe 100644 --- a/src/python_testing/TC_EWATERHTR_2_1.py +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -29,9 +29,9 @@ import logging import chip.clusters as Clusters -from TC_EWATERHTRBase import EWATERHTRBase from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts +from TC_EWATERHTRBase import EWATERHTRBase logger = logging.getLogger(__name__) diff --git a/src/python_testing/TC_EWATERHTR_2_2.py b/src/python_testing/TC_EWATERHTR_2_2.py index 78d8e8beb6d513..0d20e1d4af97f4 100644 --- a/src/python_testing/TC_EWATERHTR_2_2.py +++ b/src/python_testing/TC_EWATERHTR_2_2.py @@ -31,7 +31,6 @@ import time import chip.clusters as Clusters -from TC_EWATERHTRBase import EWATERHTRBase from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from mobly import asserts from TC_EWATERHTRBase import EWATERHTRBase From 88088ab057bb1b151c741493f6a2a252c20da188 Mon Sep 17 00:00:00 2001 From: jamesharrow <93921463+jamesharrow@users.noreply.github.com> Date: Mon, 29 Jul 2024 00:54:13 +0100 Subject: [PATCH 24/27] Update src/python_testing/TC_EWATERHTR_2_1.py --- src/python_testing/TC_EWATERHTR_2_1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py index 60908caa075fbe..69dee8fe2d6992 100644 --- a/src/python_testing/TC_EWATERHTR_2_1.py +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -100,7 +100,7 @@ async def test_TC_EWATERHTR_2_1(self): self.step("5") if em_supported: value = await self.read_whm_attribute_expect_success(attribute="EstimatedHeatRequired") - asserts.assert_greater(value, 0, f"Unexpected EstimatedHeatRequired value - expected {value} > 0") + asserts.assert_greater_equal(value, 0, f"Unexpected EstimatedHeatRequired value - expected {value} >= 0") else: logging.info("Skipping step 5 as PIXIT.EWATERHTR.EM not supported") From 7b2de5515eacb022e42b6ead5d80fedf90105e34 Mon Sep 17 00:00:00 2001 From: jamesharrow <93921463+jamesharrow@users.noreply.github.com> Date: Mon, 29 Jul 2024 00:57:14 +0100 Subject: [PATCH 25/27] Update src/python_testing/TC_EWATERHTR_2_1.py Removed assert TankVolume >= 0 --- src/python_testing/TC_EWATERHTR_2_1.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py index 69dee8fe2d6992..9a34fd5d9fc35b 100644 --- a/src/python_testing/TC_EWATERHTR_2_1.py +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -93,7 +93,6 @@ async def test_TC_EWATERHTR_2_1(self): self.step("4") if em_supported: value = await self.read_whm_attribute_expect_success(attribute="TankVolume") - asserts.assert_greater_equal(value, 0, f"Unexpected TankVolume value - expected {value} >= 0") else: logging.info("Skipping step 4 as PIXIT.EWATERHTR.EM not supported") From 5c3af526b5b6d3fe744d2a7671b544dcbd933ee1 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 29 Jul 2024 08:03:27 +0100 Subject: [PATCH 26/27] Restored TC_EEVSE_2_4.py from master --- src/python_testing/TC_EEVSE_2_4.py | 228 +++++++++++++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100644 src/python_testing/TC_EEVSE_2_4.py diff --git a/src/python_testing/TC_EEVSE_2_4.py b/src/python_testing/TC_EEVSE_2_4.py new file mode 100644 index 00000000000000..3b2db653e86b63 --- /dev/null +++ b/src/python_testing/TC_EEVSE_2_4.py @@ -0,0 +1,228 @@ +# +# Copyright (c) 2023 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: run1 +# test-runner-run/run1/app: ${ENERGY_MANAGEMENT_APP} +# test-runner-run/run1/factoryreset: True +# test-runner-run/run1/quiet: True +# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json --enable-key 000102030405060708090a0b0c0d0e0f +# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# === END CI TEST ARGUMENTS === + +import logging +import time + +import chip.clusters as Clusters +from chip.clusters.Types import NullValue +from matter_testing_support import EventChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from TC_EEVSE_Utils import EEVSEBaseTestHelper + +logger = logging.getLogger(__name__) + + +class TC_EEVSE_2_4(MatterBaseTest, EEVSEBaseTestHelper): + + def desc_TC_EEVSE_2_4(self) -> str: + """Returns a description of this test""" + return "5.1.5. [TC-EEVSE-2.4] Fault test functionality with DUT as Server" + + def pics_TC_EEVSE_2_4(self): + """ This function returns a list of PICS for this test case that must be True for the test to be run""" + # In this case - there is no feature flags needed to run this test case + return ["EEVSE.S"] + + def steps_TC_EEVSE_2_4(self) -> list[TestStep]: + steps = [ + TestStep("1", "Commissioning, already done", + is_commissioning=True), + TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster", + "Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"), + TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event"), + TestStep("3a", "After a few seconds TH reads from the DUT the State attribute", + "Verify value is 0x00 (NotPluggedIn)"), + TestStep("3b", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x00 (Disabled)"), + TestStep("3c", "TH reads from the DUT the FaultState attribute", + "Verify value is 0x00 (NoError)"), + TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event", + "Verify Event EEVSE.S.E00(EVConnected) sent"), + TestStep("4a", "TH reads from the DUT the State attribute", + "Verify value is 0x01 (PluggedInNoDemand)"), + TestStep("4b", + "TH reads from the DUT the SessionID attribute. Value is saved for later"), + TestStep("5", "TH sends command EnableCharging with ChargingEnabledUntil=Null, minimumChargeCurrent=6000, maximumChargeCurrent=60000"), + TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event", + "Verify Event EEVSE.S.E02(EnergyTransferStarted) sent."), + TestStep("6a", "TH reads from the DUT the State attribute", + "Verify value is 0x3 (PluggedInCharging)"), + TestStep("6b", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x1 (ChargingEnabled)"), + TestStep("7", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Ground Fault Test Event", + "Verify Event EEVSE.S.E04(Fault) sent with SessionID matching value in step 4b, FaultStatePreviousFaultState = 0x00 (NoError), FaultStateCurrentFaultState = 0x07 (GroundFault)"), + TestStep("7a", "TH reads from the DUT the State attribute", + "Verify value is 0x6 (Fault)"), + TestStep("7b", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x4 (DisabledError)"), + TestStep("8", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Over Temperature Fault Test Event", + "Verify Event EEVSE.S.E04(Fault) sent with SessionID matching value in step 4b, FaultStatePreviousFaultState = 0x07 (GroundFault), FaultStateCurrentFaultState = 0x0F (OverTemperature)"), + TestStep("8a", "TH reads from the DUT the State attribute", + "Verify value is 0x6 (Fault)"), + TestStep("8b", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x4 (DisabledError)"), + TestStep("9", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EVSE Fault Test Event Clear", + "Verify Event EEVSE.S.E04(Fault) sent with SessionID matching value in step 4b, FaultStatePreviousFaultState = 0x0F (OverTemperature), FaultStateCurrentFaultState = 0x00 (NoError)"), + TestStep("9a", "TH reads from the DUT the State attribute", + "Verify value is 0x3 (PluggedInCharging)"), + TestStep("9b", "TH reads from the DUT the SupplyState attribute", + "Verify value is 0x1 (ChargingEnabled)"), + TestStep("10", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Charge Demand Test Event Clear."), + TestStep("11", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for EV Plugged-in Test Event Clear", + "Verify Event EEVSE.S.E01(EVNotDetected) sent"), + TestStep("12", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEVSE.TEST_EVENT_TRIGGER for Basic Functionality Test Event Clear."), + ] + + return steps + + @async_test_body + async def test_TC_EEVSE_2_4(self): + self.step("1") + # Commission DUT - already done + + # Subscribe to Events and when they are sent push them to a queue for checking later + events_callback = EventChangeCallback(Clusters.EnergyEvse) + await events_callback.start(self.default_controller, + self.dut_node_id, + self.matter_test_config.endpoint) + + self.step("2") + await self.check_test_event_triggers_enabled() + + self.step("3") + await self.send_test_event_trigger_basic() + + # After a few seconds... + time.sleep(3) + + self.step("3a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kNotPluggedIn) + + self.step("3b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabled) + + self.step("3c") + await self.check_evse_attribute("FaultState", Clusters.EnergyEvse.Enums.FaultStateEnum.kNoError) + + self.step("4") + await self.send_test_event_trigger_pluggedin() + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EVConnected) + + self.step("4a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand) + + self.step("4b") + # Save Session ID for later and check it against the value in the event + session_id = await self.read_evse_attribute_expect_success(attribute="SessionID") + self.validate_ev_connected_event(event_data, session_id) + + self.step("5") + charge_until = NullValue + min_charge_current = 6000 + max_charge_current = 60000 + await self.send_enable_charge_command(charge_until=charge_until, min_charge=min_charge_current, max_charge=max_charge_current) + + self.step("6") + await self.send_test_event_trigger_charge_demand() + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EnergyTransferStarted) + + self.step("6a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) + + self.step("6b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kChargingEnabled) + + self.step("7") + await self.send_test_event_trigger_evse_ground_fault() + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.Fault) + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging + previous_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kNoError + current_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kGroundFault + self.validate_evse_fault_event( + event_data, session_id, expected_state, previous_fault, current_fault) + + self.step("7a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kFault) + + self.step("7b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabledError) + + self.step("8") + await self.send_test_event_trigger_evse_over_temperature_fault() + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.Fault) + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kFault + previous_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kGroundFault + current_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kOverTemperature + self.validate_evse_fault_event( + event_data, session_id, expected_state, previous_fault, current_fault) + + self.step("8a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kFault) + + self.step("8b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kDisabledError) + + self.step("9") + await self.send_test_event_trigger_evse_fault_clear() + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.Fault) + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kFault + previous_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kOverTemperature + current_fault = Clusters.EnergyEvse.Enums.FaultStateEnum.kNoError + self.validate_evse_fault_event( + event_data, session_id, expected_state, previous_fault, current_fault) + + self.step("9a") + await self.check_evse_attribute("State", Clusters.EnergyEvse.Enums.StateEnum.kPluggedInCharging) + + self.step("9b") + await self.check_evse_attribute("SupplyState", Clusters.EnergyEvse.Enums.SupplyStateEnum.kChargingEnabled) + + self.step("10") + await self.send_test_event_trigger_charge_demand_clear() + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EnergyTransferStopped) + + self.step("11") + await self.send_test_event_trigger_pluggedin_clear() + event_data = events_callback.wait_for_event_report( + Clusters.EnergyEvse.Events.EVNotDetected) + expected_state = Clusters.EnergyEvse.Enums.StateEnum.kPluggedInNoDemand + self.validate_ev_not_detected_event( + event_data, session_id, expected_state, expected_duration=0, expected_charged=0) + + self.step("12") + await self.send_test_event_trigger_basic_clear() + + +if __name__ == "__main__": + default_matter_test_main() From 4162238915de84f9d8241ae930c5aff1475565c5 Mon Sep 17 00:00:00 2001 From: James Harrow Date: Mon, 29 Jul 2024 08:23:00 +0100 Subject: [PATCH 27/27] Fixed issue raised on TC_EWATERHTR_2_1.py about checking that BoostState is in valid range. --- src/python_testing/TC_EWATERHTR_2_1.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/python_testing/TC_EWATERHTR_2_1.py b/src/python_testing/TC_EWATERHTR_2_1.py index 9a34fd5d9fc35b..c278da6c094010 100644 --- a/src/python_testing/TC_EWATERHTR_2_1.py +++ b/src/python_testing/TC_EWATERHTR_2_1.py @@ -112,7 +112,9 @@ async def test_TC_EWATERHTR_2_1(self): logging.info("Skipping step 6 as PIXIT.EWATERHTR.TP not supported") self.step("7") - await self.check_whm_attribute("BoostState", Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive) + boost_state = await self.read_whm_attribute_expect_success(attribute="BoostState") + asserts.assert_less_equal(boost_state, Clusters.WaterHeaterManagement.Enums.BoostStateEnum.kInactive, + f"Unexpected BoostState value - expected {boost_state} should be BoostStateEnum (enum8) value in range 0x00 to 0x01") if __name__ == "__main__":