diff --git a/scripts/py_matter_yamltests/matter_yamltests/hooks.py b/scripts/py_matter_yamltests/matter_yamltests/hooks.py index ca739b8ea27633..66130803030a47 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/hooks.py +++ b/scripts/py_matter_yamltests/matter_yamltests/hooks.py @@ -152,7 +152,7 @@ def step_skipped(self, name: str, expression: str): """ pass - def step_start(self, request: TestStep): + def step_start(self, request: TestStep, endpoint: int): """ This method is called when the runner starts running a step from the test. diff --git a/src/python_testing/TC_OpstateCommon.py b/src/python_testing/TC_OpstateCommon.py index e0e252ea180eb0..9622818e384108 100644 --- a/src/python_testing/TC_OpstateCommon.py +++ b/src/python_testing/TC_OpstateCommon.py @@ -1250,16 +1250,16 @@ async def TEST_TC_OPSTATE_BASE_2_6(self, endpoint=1): self.init_test() # commission - self.step(1) + self.step(1, endpoint) # Note that this does a subscribe-all instead of subscribing only to the CountdownTime attribute. # To-Do: Update the TP to subscribe-all. - self.step(2) + self.step(2, endpoint) sub_handler = ClusterAttributeChangeAccumulator(cluster) await sub_handler.start(self.default_controller, self.dut_node_id, endpoint) if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ST_RUNNING")): - self.step(3) + self.step(3, endpoint) self.send_manual_or_pipe_command(name="OperationalStateChange", device=self.device, operation="Start") @@ -1275,10 +1275,10 @@ async def TEST_TC_OPSTATE_BASE_2_6(self, endpoint=1): self.skip_step(3) sub_handler.reset() - self.step(4) + self.step(4, endpoint) countdownTime = await self.read_expect_success(endpoint=endpoint, attribute=attributes.CountdownTime) if countdownTime is not NullValue: - self.step(5) + self.step(5, endpoint) logging.info('Test will now collect data for 10 seconds') time.sleep(10) @@ -1289,13 +1289,13 @@ async def TEST_TC_OPSTATE_BASE_2_6(self, endpoint=1): else: self.skip_step(5) - self.step(6) + self.step(6, endpoint) countdownTime = await self.read_expect_success(endpoint=endpoint, attribute=attributes.CountdownTime) attr_value = await self.read_expect_success( endpoint=endpoint, attribute=attributes.OperationalState) if attr_value == cluster.Enums.OperationalStateEnum.kRunning and countdownTime is not NullValue: - self.step(7) + self.step(7, endpoint) wait_count = 0 while (attr_value != cluster.Enums.OperationalStateEnum.kStopped) and (wait_count < 20): time.sleep(1) @@ -1311,7 +1311,7 @@ async def TEST_TC_OPSTATE_BASE_2_6(self, endpoint=1): sub_handler.reset() if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ST_RUNNING")): - self.step(8) + self.step(8, endpoint) self.send_manual_or_pipe_command(name="OperationalStateChange", device=self.device, operation="Start") @@ -1326,16 +1326,16 @@ async def TEST_TC_OPSTATE_BASE_2_6(self, endpoint=1): else: self.skip_step(8) - self.step(9) + self.step(9, endpoint) await self.read_and_expect_value(endpoint=endpoint, attribute=attributes.OperationalState, expected_value=cluster.Enums.OperationalStateEnum.kRunning) sub_handler.reset() - self.step(10) + self.step(10, endpoint) countdownTime = await self.read_expect_success(endpoint=endpoint, attribute=attributes.CountdownTime) if self.pics_guard(self.check_pics(f"{self.test_info.pics_code}.S.M.ST_PAUSED")) and countdownTime is not NullValue: - self.step(11) + self.step(11, endpoint) self.send_manual_or_pipe_command(name="OperationalStateChange", device=self.device, operation="Pause") diff --git a/src/python_testing/matter_testing_support.py b/src/python_testing/matter_testing_support.py index c5d46e2306dae2..a1c1e0a1501688 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -584,9 +584,9 @@ def step_skipped(self, name: str, expression: str): # TODO: Do we really need the expression as a string? We can evaluate this in code very easily logging.info(f'\t\t**** Skipping: {name}') - def step_start(self, name: str): - # The way I'm calling this, the name is already includes the step number, but it seems like it might be good to separate these - logging.info(f'\t\t***** Test Step {name}') + def step_start(self, name: str, endpoint: int): + # TODO: The way I'm calling this, the name is already includes the step number, but it seems like it might be good to separate these + logging.info(f'\t\t***** Test Step {name} started with endpoint {endpoint}') def step_success(self, logger, logs, duration: int, request): pass @@ -1451,7 +1451,7 @@ def skip_all_remaining_steps(self, starting_step_number): for step in remaining: self.skip_step(step.test_plan_number) - def step(self, step: typing.Union[int, str]): + def step(self, step: typing.Union[int, str], endpoint: Optional[int] = None): test_name = self.current_test_info.name steps = self.get_test_steps(test_name) @@ -1468,7 +1468,12 @@ def step(self, step: typing.Union[int, str]): # TODO: it seems like the step start should take a number and a name name = f'{step} : {steps[self.current_step_index].description}' - self.runner_hook.step_start(name=name) + if endpoint is None or not isinstance(endpoint, int): + endpoint = self.matter_test_config.endpoint + logging.info( + f"========= Step {name} started with Endpoint {endpoint} =========" + ) + self.runner_hook.step_start(name=name, endpoint=endpoint) else: self.print_step(step, steps[self.current_step_index].description)