8000 [TC_CLTRL-3.1] Added new python test case for Calibrate based on test plan by uebati-siegenia · Pull Request #38299 · project-chip/connectedhomeip · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[TC_CLTRL-3.1] Added new python test case for Calibrate based on test plan #38299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

uebati-siegenia
Copy link
Contributor
@uebati-siegenia uebati-siegenia commented Apr 8, 2025

This PR adds python script for testing the Testcase TC-CLCTRL-3.1. This script should test the Calibrate command from the calibration feature of the ClosureControl Cluster.

Testing

@CLAassistant
Copy link
CLAassistant commented Apr 8, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the tests label Apr 8, 2025
Copy link
github-actions bot commented Apr 8, 2025

PR #38299: Size comparison from 2e4f22a to 7902086

Full report (10 builds for cc32xx, nrfconnect, qpg, stm32, tizen)
platform target config section 2e4f22a 7902086 change % change
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 541886 541886 0 0.0
RAM 205144 205144 0 0.0
lock CC3235SF_LAUNCHXL FLASH 575906 575906 0 0.0
RAM 205392 205392 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 916116 916116 0 0.0
RAM 167443 167443 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 909028 909028 0 0.0
RAM 145687 145687 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 852624 852624 0 0.0
RAM 141223 141223 0 0.0
qpg lighting-app qpg6105+debug FLASH 665068 665068 0 0.0
RAM 105172 105172 0 0.0
lock-app qpg6105+debug FLASH 623472 623472 0 0.0
RAM 99792 99792 0 0.0
stm32 light STM32WB5MM-DK FLASH 461136 461136 0 0.0
RAM 141488 141488 0 0.0
tizen all-clusters-app arm unknown 5152 5152 0 0.0
FLASH 1784260 1784260 0 0.0
RAM 94280 94280 0 0.0
chip-tool-ubsan arm unknown 11836 11836 0 0.0
FLASH 20057214 20057214 0 0.0
RAM 8792348 8792348 0 0.0

@AliTalebVelux AliTalebVelux self-requested a review April 10, 2025 08:03
@AliTalebVelux AliTalebVelux added App Clusters: Closures Window and Barrier (Door) Clusters v1.5 labels Apr 10, 2025
@uebati-siegenia uebati-siegenia changed the title Added new python test case based on test plan Added new python test case for Calibrate based on test plan Apr 22, 2025
@AliTalebVelux AliTalebVelux changed the title Added new python test case for Calibrate based on test plan [TC_CLTRL] Added new python test case for Calibrate based on test plan Apr 23, 2025
@AliTalebVelux AliTalebVelux changed the title [TC_CLTRL] Added new python test case for Calibrate based on test plan [TC_CLTRL-3.1] Added new python test case for Calibrate based on test plan Apr 23, 2025
@AliTalebVelux AliTalebVelux requested a review from Copilot April 23, 2025 11:53
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new Python test case for the Calibrate command based on the test plan for ClosureControl.

  • Introduces a dedicated test file implementing multiple test steps for calibrating a DUT
  • Implements error handling and reporting for various test steps related to attribute reads and command sends
Comments suppressed due to low confidence (3)

src/python_testing/TC_CLCTRL_3_1.py:105

  • The sleep function is used without an import and may block the event loop in an async context; consider using asyncio.sleep or importing time.sleep appropriately.
sleep(2)

src/python_testing/TC_CLCTRL_3_1.py:296

  • The variable 'e' is referenced outside of the corresponding except block and may not be defined if no exception is thrown, which could lead to a NameError.
if e.status == Status.INVALID_IN_STATE:

src/python_testing/TC_CLCTRL_3_1.py:281

  • [nitpick] A duplicate status check for mainstate is present; consider removing the redundant block to streamline the verification step.
if not type_matches(mainstate.status, Status.SUCCESS):

@AliTalebVelux AliTalebVelux marked this pull request as ready for review April 24, 2025 07:51
@AliTalebVelux
Copy link
Contributor

This test script will be validated once the app is finished and added to the CI at the same time.

Copy link

PR #38299: Size comparison from eeba970 to ffccc86

Full report (3 builds for cc32xx, stm32)
platform target config section eeba970 ffccc86 change % change
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 543890 543890 0 0.0
RAM 205160 205160 0 0.0
lock CC3235SF_LAUNCHXL FLASH 577870 577870 0 0.0
RAM 205408 205408 0 0.0
stm32 light STM32WB5MM-DK FLASH 464432 464432 0 0.0
RAM 141504 141504 0 0.0

def steps_TC_CLCTRL_3_1(self) -> list[TestStep]:
steps = [
TestStep(1, "Commission DUT to TH (can be skipped if done in a preceding test).", is_commissioning=True),
TestStep("2a", "TH sends command Calibrate to DUT"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test plan has a requirements to set the MainState to either SetupRequired or Stop. How is this translated to the test steps?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkardous-silabs I did this draft as solution for missing steps. Please check this and then I change the script like this.
https://github.com/CHIP-Specifications/chip-test-plans/pull/5110

# STEP 2b: after 1 seconds, TH reads from the DUT the MainState attribute
self.step("2b")

sleep(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the sleep?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its written in the testplan. See Draft for Testplan change.

Comment on lines 178 to 180
if e.status == Status.UNSUPPORTED_CLUSTER:
logging.info("Test step skipped")
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think silently failing is the best approach; if we are executing this test and the cluster is not supported, something is definetly wrong either in the pics or the device.

Copy link
8000 Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to a assert check like the other positions.

IMO it is horrible for a tester if you don't know why it is fail.

Copy link

PR #38299: Size comparison from f28fd9a to 701bc62

Full report (3 builds for cc32xx, stm32)
platform target config section f28fd9a 701bc62 change % change
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 544194 544194 0 0.0
RAM 205160 205160 0 0.0
lock CC3235SF_LAUNCHXL FLASH 578182 578182 0 0.0
RAM 205408 205408 0 0.0
stm32 light STM32WB5MM-DK FLASH 464440 464440 0 0.0
RAM 141504 141504 0 0.0

Copy link

PR #38299: Size comparison from f28fd9a to 3dd2de4

Full report (3 builds for cc32xx, stm32)
platform target config section f28fd9a 3dd2de4 change % change
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 544194 544194 0 0.0
RAM 205160 205160 0 0.0
lock CC3235SF_LAUNCHXL FLASH 578182 578182 0 0.0
RAM 205408 205408 0 0.0
stm32 light STM32WB5MM-DK FLASH 464440 464440 0 0.0
RAM 141504 141504 0 0.0

await self.send_command(endpoint=endpoint, cluster=Clusters.Objects.ClosureControl, command=Clusters.ClosureControl.Commands.Calibrate)
except InteractionModelError as e:
asserts.assert_equal(
e.status, Status.Success, "Unexpected error returned")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

success is not an exception - this will never happen.
exceptions will propagate on failure - there is no need to try/catch.

the logic below is off: the e access is outside of the except block, so it works on undefined variables.

This test needs to be actually executed before being placed as a PR

Copy link
Contributor
@andy31415 andy31415 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please complete the Testing section to at least say that you can run it manually. Right now I see no proof it can run (and linter already stops all runs because it does not pass linting).

Marking as changes requested since it did not seem to progress in several weeks.

@uebati-siegenia
Copy link
Contributor Author

This PR is added in the PR #39015.

@uebati-siegenia uebati-siegenia deleted the TC-CLCTRL-3.1 branch July 9, 2025 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0