This page will cover some of the common topics associated with Honeydew affordances
Honeydew affordances are a way to abstract away the details of how to interact with specific actions supported by Fuchsia device (such as trace, wlan, bluetooth etc.).
They provide a high-level interface that allows users to perform common tasks associated with specific Fuchsia components (such as connect operation in wlan component) without having to worry about the underlying implementation details.
For example, instead of having to know how to set up a WLAN connection, a user can simply call the connect() method on the Wlan affordance.
This makes it easier to group
class WLAN: def scan(self, ...): ... def connect(self, ...): ... ... class Bluetooth: def scan(self, ...): ... def connect(self, ...): ... ... class Trace: def start(self, ...): ... def stop(self, ...): ... ... class FuchsiaDevice: @property def wlan(self): return WLAN() @property def trace(self): return Trace() @property def bluetooth(self): return Bluetooth() ...
The following sections walk through the development process for a Honeydew affordance by creating HelloWorld affordance.
Start by creating a directory for HelloWorld affordance in honeydew code base at $FUCHSIA_DIR/src/testing/end_to_end/honeydew/honeydew/affordances/hello_world/
Create OWNERS and METADATA.textproto files with appropriate information (associated with the team who is writing the affordance)
Create __init.py__, hello_world.py and hello_world_impl.py files where:
__init__.py file in Python serves to mark this directory as a package, enabling it to be imported as a moduleHelloWorld affordanceHelloWorld affordance (in this case HelloWorldUsingFfx)In addition to these, here are few other files to consider that may be useful for some affordances:
Make sure, HelloWorld affordance ABC contract (HelloWorld) inherits Affordance ABC contract
Make sure, __init__() method in HelloWorld affordance implementation (HelloWorldUsingFfx) calls self.verify_supported(). This is to ensure if HelloWorld affordance in invoked on any FuchsiaDevice that does not support this affordance, it will raise NotSupportedError
Create tests folder under $FUCHSIA_DIR/src/testing/end_to_end/honeydew/honeydew/affordances/hello_world/ with the following subfolders:
HelloWorld affordance implementation (in this case hello_world_using_ffx.py)HelloWorld affordance implementationFor unit_tests, do the following steps to be included to run these unit tests as part of CQ
group("tests") { defined in unit_tests's BUILD.gngroup("unit_tests") { defined in Honeydew‘s BUILD.gn with HelloWorld affordance’s unit tests (//src/testing/end_to_end/honeydew/affordances/hello_world/tests/unit_tests:tests)$ fx set core.x64 --with-host //src/testing/end_to_end/honeydew:unit_tests $ fx test //src/testing/end_to_end/honeydew --host --output
For functional_tests, follow these steps:
group("tests") { defined in functional_tests's BUILD.gngroup("functional_tests") { defined in Honeydew‘s BUILD.gn with HelloWorld affordance’s unit tests (//src/testing/end_to_end/honeydew/affordances/hello_world/tests/functional_tests:tests)vim3) or Fuchsia emulator$ fx set core.x64 --with-host //src/testing/end_to_end/honeydew:functional_tests $ fx test //src/testing/end_to_end/honeydew/honeydew/affordances/hello_world/tests/functional_tests:hello_world_test --e2e --output
For these newly created functional_tests, follow these steps to be included to run these functional tests as part of infra:
workbench.[x64|vim3] etc), update the corresponding tets groups in BUILD.gn//v/g/bundles/buildbot/<PRODUCT>/<BOARD>/BUILD.gn file (this is usually done as a followup CL in tqr/, once HelloWorld affordance CL has been merged)Update python_library("honeydew_no_testonly") { defined in Honeydew's BUILD.gn with all of the HelloWorld affordance related files (excluding tests folder contents)
Update FuchsiaDevice ABC class to add HelloWorld as an affordance of this FuchsiaDevice class
Update FuchsiaDeviceImpl implementation class to return HelloWorldUsingFfx as implementation for HelloWorld affordance
You can use https://fuchsia-review.git.corp.google.com/c/fuchsia/+/1272407 as a reference while creating a new affordance.