PelionIoT / client-e2e-python-test-library

Python Test library for Izuma DM Client end-2-end tests
https://www.izumanetworks.com
Apache License 2.0
6 stars 5 forks source link
iot pytest

Client E2E Python test library

Izuma Client E2E tests verify that a target platform can perform essential Device Management Client operations. The library is designed to be used with the pytest test framework.

Prerequisites

Python 3.8 or later.

Installation

$ git clone https://github.com/PelionIoT/client-e2e-python-test-library.git
$ pip install wheel
$ python3 setup.py bdist_wheel
$ cd dist/
$ pip install -I client_test_lib*.whl

Basic usage

Running a test set

To run a test set for Device Management Client use the command:

pytest tests/dev-client-tests.py

Read later instructions how to setup the update test to go with the test set.

Running a single test

To run a single test from the set, use the -k argument to set the test name as a keyword:

pytest tests/dev-client-tests.py -k get_resource

Running the update test

Before running the update test, make sure you create update-related configuration and initialize the developer environment properly, as describe the Device Management Client example tutorial.

The update test uses the manifest-dev-tool utility to create the actual manifest for update campaigns.

To run the update test, provide the mandatory update image path and optional manifest-dev-tool init path arguments at startup:

To leave the firmware image, manifest and campaign in your account after the test, add the --no_cleanup startup argument.

Manifest tool 2.0.0 supports two manifest schema versions: v1 and v3. By default, the update test creates v3 manifests, but you can create v1 manifests by passing the --manifest_version=v1 startup argument.

Results output

Add the startup arguments to adjust the generated output:

The library also writes a separate client.log file from the Device Management Client output.

Customized test runs

There are many ways to configure the test runs. Refer to the full pytest documentation for more information.

Current tests

Test name Main functions Notes
test_01_get_device_id Verify that the device is registered.
test_02_get_resource Verify that the device responds to GET. Uses Resource /1/0/1
test_03_put_resource Verify that the device responds to PUT. Uses Resource /1/0/1
test_04_subscribe_resource Verify the notification from the subscribed resource. Uses Resource /1/0/1
test_05_factory_reset Verify the client's factory reset behaviour.
test_06_update_device Verify the device firmware update.

License

See the license agreement.