Skip to content

[Feature] Make NFC_Reader_index default 0 - #311

Merged
oxesoft merged 9 commits into
v2.16-developfrom
feature/980_default_0_index_NFC_reader_index_when_not_informed
May 26, 2026
Merged

[Feature] Make NFC_Reader_index default 0#311
oxesoft merged 9 commits into
v2.16-developfrom
feature/980_default_0_index_NFC_reader_index_when_not_informed

Conversation

@rquidute

@rquidute rquidute commented May 5, 2026

Copy link
Copy Markdown
Contributor

What Changed

Adds support for automatically defaulting NFC_Reader_index to 0 when not explicitly provided in test_parameters for NFC pairing modes (nfc-wifi and nfc-thread). This removes the need for users to always specify the reader index when a single NFC reader is in use.

Motivation

The SDK runner requires NFC_Reader_index to be present in global_test_params when using NFC commissioning. Most setups use a single NFC reader (index 0), so requiring users to always pass this parameter explicitly adds unnecessary friction. This feature makes index 0 the implicit default, allowing NFC tests to run out of the box without extra configuration.

Impact

  • No breaking changes. Users who already pass "int-arg": "NFC_Reader_index:" in test_parameters are unaffected — their value is used as-is.
  • NFC pairing mode tests now work without requiring NFC_Reader_index to be explicitly configured.

Changes

  • test_collections/matter/sdk_tests/support/python_testing/models/utils.py

    • In generate_command_arguments(), when the pairing mode is an NFC mode, checks whether NFC_Reader_index is already present in the int-arg test parameter.
    • If absent, injects NFC_Reader_index:0 into test_parameters["int-arg"] so it flows through the existing _SPLIT_ARGS loop as a single --int-arg block.
    • If already present (user explicitly set a value), the existing value is left untouched.
  • test_collections/matter/sdk_tests/support/tests/python_tests/test_utils.py

    • Updated 3 existing NFC test assertions to include --int-arg / NFC_Reader_index:0 at the end of the expected argument list.
    • Added 5 new parametrized test functions (covering both nfc-wifi and nfc-thread, totalling 9 new test cases):
      • Defaults to 0 when test_parameters is None
      • Defaults to 0 when test_parameters exists but int-arg has no NFC_Reader_index
      • Uses the explicit value when NFC_Reader_index is already in int-arg
      • Does not duplicate NFC_Reader_index when already present
      • Does not inject NFC_Reader_index for non-NFC pairing modes

Related Issue

project-chip/certification-tool#980

Testing

  • Unit tests added and all passing

  • Run a test execution with no NFC_Reader_index informed and the TH send command with --int-arg NFC_Reader_index:0

@rquidute rquidute self-assigned this May 5, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the handling of NFC pairing modes by making discriminator and setup code optional and injecting a default NFC reader index into command arguments. Feedback highlights a potential crash and side-effect in the parameter injection logic, a missing f-string prefix in a validation error message, and an inconsistency where the reader index injection is missing from performance tests.

Comment thread test_collections/matter/sdk_tests/support/python_testing/models/utils.py Outdated
Comment thread test_collections/matter/test_environment_config.py Outdated
@rquidute
rquidute changed the base branch from v2.15-develop to fix/977_fix_nfc_validation_setup_code_and_discriminator May 5, 2026 21:48
Base automatically changed from fix/977_fix_nfc_validation_setup_code_and_discriminator to v2.16-develop May 26, 2026 11:53
…_when_not_informed

# Conflicts:
#	test_collections/matter/sdk_tests/support/performance_tests/models/utils.py
#	test_collections/matter/sdk_tests/support/python_testing/models/utils.py
#	test_collections/matter/sdk_tests/support/tests/yaml_tests/test_matter_yaml_runner.py
#	test_collections/matter/sdk_tests/support/yaml_tests/models/chip_suite.py
@oxesoft
oxesoft merged commit 43ffa87 into v2.16-develop May 26, 2026
7 of 9 checks passed
@oxesoft
oxesoft deleted the feature/980_default_0_index_NFC_reader_index_when_not_informed branch May 26, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants