Skip to content

Commit 9d16395

Browse files
committed
doc: document the way of testing
[KRKNWK-14886] Signed-off-by: Krzysztof Taborowski <[email protected]>
1 parent 2cc2c09 commit 9d16395

File tree

2 files changed

+137
-0
lines changed

2 files changed

+137
-0
lines changed

doc/additional_resources.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ For additional Amazon resources, refer to the following list:
1919
* `Sidewalk terms of use`_
2020
* `Sidewalk qualification`_
2121

22+
Additional Nordic resources for developers:
23+
24+
.. toctree::
25+
:maxdepth: 1
26+
:glob:
27+
28+
testing.rst
2229

2330
.. _Introduction to Sidewalk: https://docs.sidewalk.amazon/introduction/
2431
.. _Getting Started Guide: https://docs.aws.amazon.com/iot/latest/developerguide/sidewalk-getting-started.html

doc/testing.rst

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
.. _sidewalk_testing:
2+
3+
Sidewalk Testing
4+
################
5+
6+
Levels of Testing
7+
=================
8+
9+
Testing levels are essential for a structured approach to quality assurance, allowing for targeted testing at each stage of development to reduce defects and ensure software reliability.
10+
11+
The most commonly recognized levels of testing in software development include:
12+
13+
* **Unit Testing**: Focuses on individual functions to ensure they work correctly in isolation.
14+
* **Integration Testing**: Tests the interaction between integrated components to identify issues arising from their interactions.
15+
* **System Testing**: Validates the complete and integrated software system against specified requirements.
16+
* **Acceptance Testing**: Confirms that the software meets the business needs and is ready for deployment, often involving end-user validation.
17+
18+
.. note::
19+
20+
There is sometimes a confusion between *integration* tests and *functional* tests as they both require multiple components to interact with each other.
21+
For the purposes of this document, *integration* term is used to describe tests that verify components, but not necessarily the system as a whole.
22+
23+
For System Testing and Acceptance Testing, you can use Sidewalk sample variants, such as:
24+
25+
* CLI - application to test against the Sidewalk Test Specification.
26+
* Sensor monitoring - example of a sensor device use case, with release configuration support.
27+
28+
In this document we focus on Unit and Integration testing, as they are delivered as part of the sdk-sidewalk repository.
29+
30+
Table below provides a comparison of Unit and Integration testing in the Sidewalk SDK:
31+
32+
+----------------+---------------------+--------------------------+
33+
| | Unit | Integration |
34+
+================+=====================+==========================+
35+
| Scope | One source file | One module |
36+
+----------------+---------------------+--------------------------+
37+
| Platform | * unit_testing (PC) | * native_sim (PC) |
38+
| | | * nRF development boards |
39+
+----------------+---------------------+--------------------------+
40+
| Frameworks | * Ztest | * Ztest |
41+
| | * Twister | * Twister |
42+
| | * FFF | |
43+
+----------------+---------------------+--------------------------+
44+
| Allows mocking | Yes | No |
45+
+----------------+---------------------+--------------------------+
46+
47+
48+
Unit Testing
49+
============
50+
51+
Unit tests are designed to test individual functions or methods in isolation to ensure they work as expected.
52+
53+
To run unit test:
54+
55+
#. Go to the unit test folder:
56+
57+
.. code-block:: bash
58+
59+
cd sidewalk/tests/unit/<test_name>
60+
61+
#. Build the test application by running the following command:
62+
63+
.. code-block:: bash
64+
65+
west build --no-sysbuild -b unit_testing
66+
67+
#. Run the test application by running the following command:
68+
69+
.. code-block:: bash
70+
71+
./build/testbinary
72+
73+
Integration Testing
74+
===================
75+
76+
Integration tests are designed to verify that multiple components work together as expected.
77+
78+
There are two main purposes of integration tests:
79+
80+
* Verify that multiple files and functions work together as one module, e.g. crypto, timer, storage. Those tests typically operates on Sidewalk Platform Abstraction Layer (PAL) API. Usually there is a dedicated Kconfig option to enable/disable the module.
81+
* Verify that module works correctly on specify Nordic SoC. This type of tests was sometimes called "unit test on hardware".
82+
83+
To run integration test:
84+
85+
.. tabs::
86+
87+
.. tab:: native_sim (PC)
88+
89+
#. Go to the integration test folder:
90+
91+
.. code-block:: bash
92+
93+
cd sidewalk/tests/integration/<test_name>
94+
95+
#. Build the test application by running the following command:
96+
97+
.. code-block:: bash
98+
99+
west build -b native_sim
100+
101+
#. Run the test application by running the following command:
102+
103+
.. code-block:: bash
104+
105+
./build/<test_name>/zephyr/zephyr.exe
106+
107+
.. tab:: nRF (development boards)
108+
109+
#. Go to the integration test folder:
110+
111+
.. code-block:: bash
112+
113+
cd sidewalk/tests/integration/<test_name>
114+
115+
#. Build the test application by running the following command:
116+
117+
.. code-block:: bash
118+
119+
west build -b <board_name>
120+
121+
Use your board name e.g. ``nRF52840dk/nrf52840``, ``nRF55l15dk/nrf54l15/cpuapp``.
122+
123+
#. Flash the test application running the following command:
124+
125+
.. code-block:: bash
126+
127+
west flash
128+
129+
Make sure your board is connected to the computer.
130+
Test output will be displayed on the UART console.

0 commit comments

Comments
 (0)