From 0d1d8bb84622834e8663fef004362186bef7a820 Mon Sep 17 00:00:00 2001 From: juandediosg Date: Mon, 17 Feb 2025 10:16:55 -0600 Subject: [PATCH 1/8] Implement TC_DISHM_1_2 with Python --- src/python_testing/TC_DISHM_1_2.py | 110 +++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 src/python_testing/TC_DISHM_1_2.py diff --git a/src/python_testing/TC_DISHM_1_2.py b/src/python_testing/TC_DISHM_1_2.py new file mode 100644 index 00000000000000..be3eb65e52713c --- /dev/null +++ b/src/python_testing/TC_DISHM_1_2.py @@ -0,0 +1,110 @@ +# +# Copyright (c) 2025 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. +# +# FIXME: https://github.com/project-chip/connectedhomeip/issues/36885 +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: +# run1: +# app: ${CHIP_MICROWAVE_OVEN_APP} +# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# script-args: > +# --storage-path admin_storage.json +# --commissioning-method on-network +# --discriminator 1234 +# --passcode 20202021 +# --PICS src/app/tests/suites/certification/ci-pics-values +# --endpoint 1 +# --trace-to json:${TRACE_TEST_JSON}.json +# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# factory-reset: true +# quiet: true +# === END CI TEST ARGUMENTS === + + +import chip.clusters as Clusters +from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from modebase_cluster_check import ModeBaseClusterChecks + +CLUSTER = Clusters.RefrigeratorAndTemperatureControlledCabinetMode + + +class TC_DISHM_1_2(MatterBaseTest, ModeBaseClusterChecks): + + def __init__(self, *args): + MatterBaseTest.__init__(self, *args) + ModeBaseClusterChecks.__init__(self, + modebase_derived_cluster=CLUSTER) + + def desc_TC_DISHM_1_2(self) -> str: + return "[TC-DISHM-1.2] Cluster attributes with DUT as Server" + + def steps_TC_DISHM_1_2(self) -> list[TestStep]: + steps = [ + TestStep(1, "Commissioning, already done", is_commissioning=True), + TestStep(2, "TH reads from the DUT the SupportedModes attribute."), + TestStep(3, "TH reads from the DUT the CurrentMode attribute."), + TestStep(4, "TH reads from the DUT the OnMode attribute."), + TestStep(5, "TH reads from the DUT the StartUpMode attribute.") + ] + return steps + + def pics_TC_DISHM_1_2(self) -> list[str]: + pics = [ + "DISHM.S" + ] + return pics + + @async_test_body + async def test_TC_DISHM_1_2(self): + + # Setup common mode check + endpoint = self.get_endpoint(default=1) + + self.step(1) + + self.step(2) + # Verify common checks for Mode Base as described in the TC-DISHM-1.2 + supported_modes = await self.check_supported_modes_and_labels(endpoint=endpoint) + # According to the spec, there should be at least one RapidCool or RapidFreeze tag in + # the ones supported. + additional_tags = [CLUSTER.Enums.ModeTag.kRapidCool, + CLUSTER.Enums.ModeTag.kRapidFreeze] + self.check_tags_in_lists(supported_modes=supported_modes, required_tags=additional_tags) + + self.step(3) + # Verify that the CurrentMode attribute has a valid value. + mode = self.cluster.Attributes.CurrentMode + await self.read_and_check_mode(endpoint=endpoint, mode=mode, supported_modes=supported_modes) + + self.step(4) + # Verify that the OnMode attribute has a valid value or null. + mode = self.cluster.Attributes.OnMode + await self.read_and_check_mode(endpoint=endpoint, mode=mode, + supported_modes=supported_modes, is_nullable=True) + + self.step(5) + # Verify that the StartUpMode has a valid value or null + mode = self.cluster.Attributes.StartUpMode + await self.read_and_check_mode(endpoint=endpoint, mode=mode, + supported_modes=supported_modes, is_nullable=True) + + +if __name__ == "__main__": + default_matter_test_main() From 2dd8ecc620cf7bd6b9752f252b47cc3aa3affbf1 Mon Sep 17 00:00:00 2001 From: juandediosg Date: Mon, 17 Feb 2025 19:00:05 -0600 Subject: [PATCH 2/8] Implemented functionality to validate DISHM in tests --- src/python_testing/TC_DISHM_1_2.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/python_testing/TC_DISHM_1_2.py b/src/python_testing/TC_DISHM_1_2.py index be3eb65e52713c..bd439091afd4a4 100644 --- a/src/python_testing/TC_DISHM_1_2.py +++ b/src/python_testing/TC_DISHM_1_2.py @@ -42,7 +42,7 @@ from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from modebase_cluster_check import ModeBaseClusterChecks -CLUSTER = Clusters.RefrigeratorAndTemperatureControlledCabinetMode +CLUSTER = Clusters.DishwasherMode class TC_DISHM_1_2(MatterBaseTest, ModeBaseClusterChecks): @@ -82,10 +82,10 @@ async def test_TC_DISHM_1_2(self): self.step(2) # Verify common checks for Mode Base as described in the TC-DISHM-1.2 supported_modes = await self.check_supported_modes_and_labels(endpoint=endpoint) - # According to the spec, there should be at least one RapidCool or RapidFreeze tag in + # According to the spec, there should be at least one Normal, Heavy, OR Light tag in # the ones supported. - additional_tags = [CLUSTER.Enums.ModeTag.kRapidCool, - CLUSTER.Enums.ModeTag.kRapidFreeze] + additional_tags = [CLUSTER.Enums.ModeTag.kNormal, + CLUSTER.Enums.ModeTag.kHeavy] self.check_tags_in_lists(supported_modes=supported_modes, required_tags=additional_tags) self.step(3) From ab97fe3e26b47757b62bf97d7db5d8bbfa7838ce Mon Sep 17 00:00:00 2001 From: juandediosg Date: Mon, 17 Feb 2025 19:29:20 -0600 Subject: [PATCH 3/8] Update functionality to validate DISHM in tests --- src/python_testing/TC_DISHM_1_2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/python_testing/TC_DISHM_1_2.py b/src/python_testing/TC_DISHM_1_2.py index bd439091afd4a4..c457241a2be968 100644 --- a/src/python_testing/TC_DISHM_1_2.py +++ b/src/python_testing/TC_DISHM_1_2.py @@ -82,8 +82,9 @@ async def test_TC_DISHM_1_2(self): self.step(2) # Verify common checks for Mode Base as described in the TC-DISHM-1.2 supported_modes = await self.check_supported_modes_and_labels(endpoint=endpoint) - # According to the spec, there should be at least one Normal, Heavy, OR Light tag in - # the ones supported. + # According to the spec, there should be at least one like + # Normal, Heavy, or Light + # tag in the ones supported. additional_tags = [CLUSTER.Enums.ModeTag.kNormal, CLUSTER.Enums.ModeTag.kHeavy] self.check_tags_in_lists(supported_modes=supported_modes, required_tags=additional_tags) From d6b9174ec8b68a30e54cfb16952b78c2eba3dea2 Mon Sep 17 00:00:00 2001 From: juandediosg Date: Tue, 18 Feb 2025 17:02:16 -0600 Subject: [PATCH 4/8] Fixed: Updated CI Test arguments --- src/python_testing/TC_DISHM_1_2.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/python_testing/TC_DISHM_1_2.py b/src/python_testing/TC_DISHM_1_2.py index c457241a2be968..ec4aa0dd353006 100644 --- a/src/python_testing/TC_DISHM_1_2.py +++ b/src/python_testing/TC_DISHM_1_2.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Project CHIP Authors +# Copyright (c) 2024 Project CHIP Authors # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,21 +15,19 @@ # 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. -# -# FIXME: https://github.com/project-chip/connectedhomeip/issues/36885 # === BEGIN CI TEST ARGUMENTS === # test-runner-runs: # run1: -# app: ${CHIP_MICROWAVE_OVEN_APP} -# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# app: ${ALL_CLUSTERS_APP} +# app-args: > +# --discriminator 1234 +# --KVS kvs1 +# --trace-to json:${TRACE_APP}.json # script-args: > # --storage-path admin_storage.json # --commissioning-method on-network # --discriminator 1234 # --passcode 20202021 -# --PICS src/app/tests/suites/certification/ci-pics-values # --endpoint 1 # --trace-to json:${TRACE_TEST_JSON}.json # --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto From e01fbce754ac35f639086045a4e902ef49cedfdd Mon Sep 17 00:00:00 2001 From: juandediosg Date: Tue, 18 Feb 2025 17:06:42 -0600 Subject: [PATCH 5/8] Fixed: Updated Copyright year --- src/python_testing/TC_DISHM_1_2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_DISHM_1_2.py b/src/python_testing/TC_DISHM_1_2.py index ec4aa0dd353006..88984d4d2b55d6 100644 --- a/src/python_testing/TC_DISHM_1_2.py +++ b/src/python_testing/TC_DISHM_1_2.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2024 Project CHIP Authors +# Copyright (c) 2025 Project CHIP Authors # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); From a669bbfef576d1c449b42a217a884c7607bdfb62 Mon Sep 17 00:00:00 2001 From: juandediosg Date: Wed, 19 Feb 2025 19:23:18 -0600 Subject: [PATCH 6/8] Updated: Removed validations for disallowed attributes (OnMode and StartupMode) based on specs from Test Plan. --- src/python_testing/TC_DISHM_1_2.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/python_testing/TC_DISHM_1_2.py b/src/python_testing/TC_DISHM_1_2.py index 88984d4d2b55d6..af0e1efbe500db 100644 --- a/src/python_testing/TC_DISHM_1_2.py +++ b/src/python_testing/TC_DISHM_1_2.py @@ -57,9 +57,7 @@ def steps_TC_DISHM_1_2(self) -> list[TestStep]: steps = [ TestStep(1, "Commissioning, already done", is_commissioning=True), TestStep(2, "TH reads from the DUT the SupportedModes attribute."), - TestStep(3, "TH reads from the DUT the CurrentMode attribute."), - TestStep(4, "TH reads from the DUT the OnMode attribute."), - TestStep(5, "TH reads from the DUT the StartUpMode attribute.") + TestStep(3, "TH reads from the DUT the CurrentMode attribute.") ] return steps @@ -92,18 +90,6 @@ async def test_TC_DISHM_1_2(self): mode = self.cluster.Attributes.CurrentMode await self.read_and_check_mode(endpoint=endpoint, mode=mode, supported_modes=supported_modes) - self.step(4) - # Verify that the OnMode attribute has a valid value or null. - mode = self.cluster.Attributes.OnMode - await self.read_and_check_mode(endpoint=endpoint, mode=mode, - supported_modes=supported_modes, is_nullable=True) - - self.step(5) - # Verify that the StartUpMode has a valid value or null - mode = self.cluster.Attributes.StartUpMode - await self.read_and_check_mode(endpoint=endpoint, mode=mode, - supported_modes=supported_modes, is_nullable=True) - if __name__ == "__main__": default_matter_test_main() From 4d9e2ca6cd72a7d5a41875e35e5bf1d521d05565 Mon Sep 17 00:00:00 2001 From: juandediosg Date: Thu, 20 Feb 2025 18:18:14 -0600 Subject: [PATCH 7/8] Fixed: Renamed CLUSTER to cluster_dishm_mode for clarity. --- src/python_testing/TC_DISHM_1_2.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/python_testing/TC_DISHM_1_2.py b/src/python_testing/TC_DISHM_1_2.py index af0e1efbe500db..266fdb3c1f77e3 100644 --- a/src/python_testing/TC_DISHM_1_2.py +++ b/src/python_testing/TC_DISHM_1_2.py @@ -40,7 +40,7 @@ from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from modebase_cluster_check import ModeBaseClusterChecks -CLUSTER = Clusters.DishwasherMode +cluster_dishm_mode = Clusters.DishwasherMode class TC_DISHM_1_2(MatterBaseTest, ModeBaseClusterChecks): @@ -48,7 +48,7 @@ class TC_DISHM_1_2(MatterBaseTest, ModeBaseClusterChecks): def __init__(self, *args): MatterBaseTest.__init__(self, *args) ModeBaseClusterChecks.__init__(self, - modebase_derived_cluster=CLUSTER) + modebase_derived_cluster=cluster_dishm_mode) def desc_TC_DISHM_1_2(self) -> str: return "[TC-DISHM-1.2] Cluster attributes with DUT as Server" @@ -81,13 +81,13 @@ async def test_TC_DISHM_1_2(self): # According to the spec, there should be at least one like # Normal, Heavy, or Light # tag in the ones supported. - additional_tags = [CLUSTER.Enums.ModeTag.kNormal, - CLUSTER.Enums.ModeTag.kHeavy] + additional_tags = [cluster_dishm_mode.Enums.ModeTag.kNormal, + cluster_dishm_mode.Enums.ModeTag.kHeavy] self.check_tags_in_lists(supported_modes=supported_modes, required_tags=additional_tags) self.step(3) # Verify that the CurrentMode attribute has a valid value. - mode = self.cluster.Attributes.CurrentMode + mode = cluster_dishm_mode.Attributes.CurrentMode await self.read_and_check_mode(endpoint=endpoint, mode=mode, supported_modes=supported_modes) From f4fa6fe65d78db5d99021127c42b38ef7a5065b5 Mon Sep 17 00:00:00 2001 From: juandediosg Date: Thu, 20 Feb 2025 18:30:07 -0600 Subject: [PATCH 8/8] Fixed: Verification CurrentMode. --- src/python_testing/TC_DISHM_1_2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_DISHM_1_2.py b/src/python_testing/TC_DISHM_1_2.py index 266fdb3c1f77e3..403a1d2f6919da 100644 --- a/src/python_testing/TC_DISHM_1_2.py +++ b/src/python_testing/TC_DISHM_1_2.py @@ -87,7 +87,7 @@ async def test_TC_DISHM_1_2(self): self.step(3) # Verify that the CurrentMode attribute has a valid value. - mode = cluster_dishm_mode.Attributes.CurrentMode + mode = self.cluster.Attributes.CurrentMode await self.read_and_check_mode(endpoint=endpoint, mode=mode, supported_modes=supported_modes)