Skip to content

Commit 54d5773

Browse files
jamesharrowaustina-csa
authored andcommitted
Tidy-up of the Energy Management related test cases from 1.3 which now use the 3rd arg of TestStep to split the verification step into a separate string. Helps with readability and PEP8 long line warnings. (project-chip#34243)
1 parent 4a2851b commit 54d5773

10 files changed

+370
-184
lines changed

src/python_testing/TC_EEM_2_1.py

+24-12
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,20 @@ def pics_TC_EEM_2_1(self):
4444

4545
def steps_TC_EEM_2_1(self) -> list[TestStep]:
4646
steps = [
47-
TestStep("1", "Commissioning, already done", is_commissioning=True),
48-
TestStep("2", "TH reads Accuracy attribute. Verify that the DUT response contains a MeasurementAccuracyStruct value."),
49-
TestStep("3", "TH reads CumulativeEnergyImported attribute. Verify that the DUT response contains either null or an EnergyMeasurementStruct value."),
50-
TestStep("4", "TH reads CumulativeEnergyExported attribute. Verify that the DUT response contains either null or an EnergyMeasurementStruct value."),
51-
TestStep("5", "TH reads PeriodicEnergyImported attribute. Verify that the DUT response contains either null or an EnergyMeasurementStruct value."),
52-
TestStep("6", "TH reads PeriodicEnergyExported attribute. Verify that the DUT response contains either null or an EnergyMeasurementStruct value."),
53-
TestStep("7", "TH reads CumulativeEnergyReset attribute. Verify that the DUT response contains either null or an CumulativeEnergyResetStruct value."),
47+
TestStep("1", "Commissioning, already done",
48+
is_commissioning=True),
49+
TestStep("2", "TH reads Accuracy attribute",
50+
"Verify that the DUT response contains a MeasurementAccuracyStruct value."),
51+
TestStep("3", "TH reads CumulativeEnergyImported attribute",
52+
"Verify that the DUT response contains either null or an EnergyMeasurementStruct value."),
53+
TestStep("4", "TH reads CumulativeEnergyExported attribute",
54+
"Verify that the DUT response contains either null or an EnergyMeasurementStruct value."),
55+
TestStep("5", "TH reads PeriodicEnergyImported attribute",
56+
"Verify that the DUT response contains either null or an EnergyMeasurementStruct value."),
57+
TestStep("6", "TH reads PeriodicEnergyExported attribute",
58+
"Verify that the DUT response contains either null or an EnergyMeasurementStruct value."),
59+
TestStep("7", "TH reads CumulativeEnergyReset attribute",
60+
"Verify that the DUT response contains either null or an CumulativeEnergyResetStruct value."),
5461
]
5562

5663
return steps
@@ -64,29 +71,34 @@ async def test_TC_EEM_2_1(self):
6471
self.step("2")
6572
accuracy = await self.read_eem_attribute_expect_success("Accuracy")
6673
logger.info(f"Rx'd Accuracy: {accuracy}")
67-
asserts.assert_not_equal(accuracy, NullValue, "Accuracy is not allowed to be null")
74+
asserts.assert_not_equal(
75+
accuracy, NullValue, "Accuracy is not allowed to be null")
6876
asserts.assert_equal(accuracy.measurementType, Clusters.ElectricalEnergyMeasurement.Enums.MeasurementTypeEnum.kElectricalEnergy,
6977
"Accuracy measurementType must be ElectricalEnergy")
7078

7179
self.step("3")
7280
if self.pics_guard(self.check_pics("EEM.S.A0001")):
7381
cumulativeEnergyImported = await self.read_eem_attribute_expect_success("CumulativeEnergyImported")
74-
logger.info(f"Rx'd CumulativeEnergyImported: {cumulativeEnergyImported}")
82+
logger.info(
83+
f"Rx'd CumulativeEnergyImported: {cumulativeEnergyImported}")
7584

7685
self.step("4")
7786
if self.pics_guard(self.check_pics("EEM.S.A0002")):
7887
cumulativeEnergyExported = await self.read_eem_attribute_expect_success("CumulativeEnergyExported")
79-
logger.info(f"Rx'd CumulativeEnergyExported: {cumulativeEnergyExported}")
88+
logger.info(
89+
f"Rx'd CumulativeEnergyExported: {cumulativeEnergyExported}")
8090

8191
self.step("5")
8292
if self.pics_guard(self.check_pics("EEM.S.A0003")):
8393
periodicEnergyImported = await self.read_eem_attribute_expect_success("PeriodicEnergyImported")
84-
logger.info(f"Rx'd PeriodicEnergyImported: {periodicEnergyImported}")
94+
logger.info(
95+
f"Rx'd PeriodicEnergyImported: {periodicEnergyImported}")
8596

8697
self.step("6")
8798
if self.pics_guard(self.check_pics("EEM.S.A0004")):
8899
periodicEnergyExported = await self.read_eem_attribute_expect_success("PeriodicEnergyExported")
89-
logger.info(f"Rx'd PeriodicEnergyExported: {periodicEnergyExported}")
100+
logger.info(
101+
f"Rx'd PeriodicEnergyExported: {periodicEnergyExported}")
90102

91103
self.step("7")
92104
if self.pics_guard(self.check_pics("EEM.S.A0005")):

src/python_testing/TC_EEM_2_2.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@ def pics_TC_EEM_2_2(self):
4040

4141
def steps_TC_EEM_2_2(self) -> list[TestStep]:
4242
steps = [
43-
TestStep("1", "Commissioning, already done", is_commissioning=True),
44-
TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"),
43+
TestStep("1", "Commissioning, already done",
44+
is_commissioning=True),
45+
TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster",
46+
"Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"),
4547
TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Start Fake Load Test 1kW Event"),
4648
TestStep("4", "Wait 3 seconds"),
47-
TestStep("4a", "TH reads from the DUT the CumulativeEnergyImported attribute. Verify the read is successful and note the value read."),
49+
TestStep("4a", "TH reads from the DUT the CumulativeEnergyImported attribute",
50+
"Verify the read is successful and note the value read."),
4851
TestStep("5", "Wait 3 seconds"),
49-
TestStep("5a", "TH reads from the DUT the CumulativeEnergyImported attribute. Verify the read is successful and that the value is greater than the value measured in step 4a."),
52+
TestStep("5a", "TH reads from the DUT the CumulativeEnergyImported attribute",
53+
"Verify the read is successful and that the value is greater than the value measured in step 4a."),
5054
TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Stop Fake Readings Test Event."),
5155
]
5256

src/python_testing/TC_EEM_2_3.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@ def pics_TC_EEM_2_3(self):
4040

4141
def steps_TC_EEM_2_3(self) -> list[TestStep]:
4242
steps = [
43-
TestStep("1", "Commissioning, already done", is_commissioning=True),
44-
TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"),
43+
TestStep("1", "Commissioning, already done",
44+
is_commissioning=True),
45+
TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster",
46+
"Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"),
4547
TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Start Fake Generator Test 3kW Event"),
4648
TestStep("4", "Wait 6 seconds"),
47-
TestStep("4a", "TH reads from the DUT the CumulativeEnergyExported attribute. Verify the read is successful and note the value read."),
49+
TestStep("4a", "TH reads from the DUT the CumulativeEnergyExported attribute",
50+
"Verify the read is successful and note the value read."),
4851
TestStep("5", "Wait 6 seconds"),
49-
TestStep("5a", "TH reads from the DUT the CumulativeEnergyExported attribute. Verify the read is successful and that the value is greater than the value measured in step 4a."),
52+
TestStep("5a", "TH reads from the DUT the CumulativeEnergyExported attribute",
53+
"Verify the read is successful and that the value is greater than the value measured in step 4a."),
5054
TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Stop Fake Readings Test Event."),
5155
]
5256

src/python_testing/TC_EEM_2_4.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@ def pics_TC_EEM_2_4(self):
4040

4141
def steps_TC_EEM_2_4(self) -> list[TestStep]:
4242
steps = [
43-
TestStep("1", "Commissioning, already done", is_commissioning=True),
44-
TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"),
43+
TestStep("1", "Commissioning, already done",
44+
is_commissioning=True),
45+
TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster",
46+
"Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"),
4547
TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Start Fake Load Test 1kW Event"),
4648
TestStep("4", "Wait 3 seconds"),
47-
TestStep("4a", "TH reads from the DUT the PeriodicEnergyImported attribute. Verify the read is successful and note the value read."),
49+
TestStep("4a", "TH reads from the DUT the PeriodicEnergyImported attribute",
50+
"Verify the read is successful and note the value read."),
4851
TestStep("5", "Wait 3 seconds"),
49-
TestStep("5a", "TH reads from the DUT the PeriodicEnergyImported attribute. Verify the read is successful and that the value read has to be different from value measure in step 4a."),
52+
TestStep("5a", "TH reads from the DUT the PeriodicEnergyImported attribute",
53+
"Verify the read is successful and that the value read has to be different from value measure in step 4a."),
5054
TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Stop Fake Readings Test Event."),
5155
]
5256

src/python_testing/TC_EEM_2_5.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@ def pics_TC_EEM_2_5(self):
4040

4141
def steps_TC_EEM_2_5(self) -> list[TestStep]:
4242
steps = [
43-
TestStep("1", "Commissioning, already done", is_commissioning=True),
44-
TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster. Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"),
43+
TestStep("1", "Commissioning, already done",
44+
is_commissioning=True),
45+
TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster",
46+
"Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"),
4547
TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Start Fake Generator Test 3kW Event"),
4648
TestStep("4", "Wait 6 seconds"),
47-
TestStep("4a", "TH reads from the DUT the PeriodicEnergyExported attribute. Verify the read is successful and note the value read."),
49+
TestStep("4a", "TH reads from the DUT the PeriodicEnergyExported attribute",
50+
"Verify the read is successful and note the value read."),
4851
TestStep("5", "Wait 6 seconds"),
49-
TestStep("5a", "TH reads from the DUT the PeriodicEnergyExported attribute. Verify the read is successful and that the value read has to be different from value measure in step 4a."),
52+
TestStep("5a", "TH reads from the DUT the PeriodicEnergyExported attribute",
53+
"Verify the read is successful and that the value read has to be different from value measure in step 4a."),
5054
TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Stop Fake Readings Test Event."),
5155
]
5256

0 commit comments

Comments
 (0)