Skip to content

Commit

Permalink
Documentation for YAML tests (#31575)
Browse files Browse the repository at this point in the history
* YAML schema: add generator file

* Docs: Start of testing documentation

Pulls from the test harness presentations in Korea and Geneva

* It's good to save before committing

* docs: add generator for pseudocluster tables

* add pseudoclusters into yaml doc

* a bit more

* fix loader

* add titles

* fix linter

* Restyled by prettier-markdown

* Restyled by autopep8

* Restyled by isort

* fix spelling

* add pics and pixit placeholder file

* ignore generated files in spellcheck

* update word list

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Feb 22, 2024
1 parent d01addd commit 1522840
Show file tree
Hide file tree
Showing 15 changed files with 816 additions and 73 deletions.
13 changes: 13 additions & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ ASR
AssertionError
AST
ASYNC
ATLs
atomics
att
attId
Expand Down Expand Up @@ -160,6 +161,7 @@ blockquote
bluetoothd
bluez
BOOL
booleans
BooleanState
bootable
Bootloader
Expand Down Expand Up @@ -380,6 +382,7 @@ DefaultOTARequestor
DefaultOTARequestorDriver
DefaultOTARequestorStorage
DefaultSuccess
defaultValue
definedValue
DehumidificationControl
DelayedActionTime
Expand Down Expand Up @@ -503,6 +506,7 @@ emberAfExternalAttributeReadCallback
emberAfExternalAttributeWriteCallback
EmberAfInitializeAttributes
emberAfSetDynamicEndpoint
emsp
EnableNetwork
EnableWiFiNetwork
endian
Expand Down Expand Up @@ -604,6 +608,7 @@ GenericWiFiConfigurationManagerImpl
GetDeviceId
GetDeviceInfo
GetDns
GetInDevelopmentTests
GetIP
getManualTests
GetSafeAttributePersistenceProvider
Expand Down Expand Up @@ -673,6 +678,7 @@ IasWd
iaszone
ibb
ICA
ICAC
ICD
ICDs
iCloud
Expand Down Expand Up @@ -724,6 +730,7 @@ IoT
ipaddr
iPadOS
ipadr
IPK
ipp
iptables
iputils
Expand Down Expand Up @@ -935,6 +942,7 @@ namespacing
nano
natively
navpad
nbsp
NCP
ncs
nding
Expand Down Expand Up @@ -1076,6 +1084,7 @@ Pigweed
PinCode
pinrequest
PIXIT
PIXITs
pkgconfig
PKI
plaintext
Expand Down Expand Up @@ -1155,6 +1164,7 @@ RADVD
raspberryPi
RasPi
rAv
RCAC
RCP
ReadAttribute
ReadConfigValue
Expand Down Expand Up @@ -1219,6 +1229,7 @@ RTOS
RTT
RTX
runArgs
runIf
RUNAS
RunMain
runtime
Expand All @@ -1227,6 +1238,7 @@ rw
RXD
sandboxed
saveAs
saveDataVersschemaionAs
sbin
scalability
scalable
Expand Down Expand Up @@ -1377,6 +1389,7 @@ TestArray
TestCluster
TestConstraints
TestEmptyString
TestEqualities
TestGenExample
TestGroupDemoConfig
TestMultiRead
Expand Down
4 changes: 2 additions & 2 deletions .spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#
# Actual run:
#
# pyspelling pyspelling --config .spellcheck.yml
# pyspelling --config .spellcheck.yml

matrix:
- name: markdown
Expand Down Expand Up @@ -65,6 +65,6 @@ matrix:
# converts markdown to HTML
- pyspelling.filters.markdown:
sources:
- '**/*.md|!third_party/**|!examples/common/**/repo/**|!docs/ERROR_CODES.md|!docs/clusters.md'
- '**/*.md|!third_party/**|!examples/common/**/repo/**|!docs/ERROR_CODES.md|!docs/clusters.md|!docs/testing/yaml_schema.md|!docs/testing/yaml_pseudocluster.md'
aspell:
ignore-case: true
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cluster_and_device_type_dev/index
guides/index
style/index
examples/index
testing/index
tools/index
BUG_REPORT
code_generation
Expand Down
6 changes: 6 additions & 0 deletions docs/testing/ci_testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# CI testing

This file is a placeholder for information on how to run tests in the CI.

NOTE: discuss in particular triggers direct to the device, test event triggers
and the CI pics.
31 changes: 31 additions & 0 deletions docs/testing/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Testing Guides

The following guide provide an introduction to the testing mechanisms available
in the SDK.

```{toctree}
:glob:
:maxdepth: 1
:hidden:
*
```

## Unit testing

- [Unit tests](./unit_testing.md)

## Integration and Certification tests

- [Integration and Certification tests](./integration_tests.md)
- [YAML](./yaml.md)
- [Python testing framework](./python.md)
- [Enabling tests in the CI](./ci_testing.md)

## PICS and PIXIT

- [PICS and PIXIT](./pics_and_pixit.md)

## Testing in the CI

- [CI testing](./ci_testing.md)
46 changes: 46 additions & 0 deletions docs/testing/integration_tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Integration and Certification Tests

Integration tests use a server and a controller or controllers to test the
behavior of a device. Certification tests are all integration tests. For
certified products, the device under test (DUT) is tested against one of the SDK
controller implementations (either chip-tool or the python-based controller,
depending on the test type). For software component certification, the software
component is tested against a sample device built from the SDK.

Certification tests require an accompanying certification test plan in order to
be used in the certification testing process. More information about test plans
can be found in the
[test plans repository](https://github.com/CHIP-Specifications/chip-test-plans/tree/master/docs).
Integration testing can also be used outside of the certification testing
program to test device behavior in the SDK. Certification tests are all run in
the [CI](./ci_testing).

There are two main integration test types:

- [YAML](./yaml.md)
- [Python framework](./python.md)

YAML is a human-readable serialization language that uses structured tags to
define test steps. Tests are defined in YAML, and parsed and run through a
runner that is backed by the chip-tool controller.

The Python framework tests are written in python and use the
[Mobly](https://github.com/google/mobly) test framework to execute tests.

## Which test framework to use

Both types of tests can be run through the Test Harness for certification
testing, locally for the purposes of development and in the CI for the SDK. The
appropriate test framework to use is whatever lets you automate your tests in a
way that is understandable, readable, and has the features you need

- YAML
- pros: more readable, simpler to write, easy for ATLs to parse and
understand
- cons: conditionals are harder (not all supported), no branch control,
schema not well documented
- python
- pros: full programming language, full control API with support for core
(certs, commissioning, etc), less plumbing if you need to add features,
can use python libraries
- cons: more complex, can be harder to read
10 changes: 10 additions & 0 deletions docs/testing/pics_and_pixit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# PICS and PIXITs

Placeholder file for PICS and PIXIT info

- PICS formats - XML vs. test harness
- PICS in CI
- PICS tool and how we practically use it in Matter
- PICS checker test
- PIXITs in tests and how to set them
- Why you should avoid using both of these things.
6 changes: 6 additions & 0 deletions docs/testing/python.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Python framework tests

This file is a placeholder for python framework test information.

NOTE: be sure to include information about how you need to commission with the
python controller, not chip-tool and how to do that in the scripts
3 changes: 3 additions & 0 deletions docs/testing/unit_testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Unit testing

This doc is a placeholder for an guide around unit tests.
Loading

0 comments on commit 1522840

Please sign in to comment.