This page provides best practices, examples, and reference materials for using
Fuchsia's Lacewing framework for writing host-driven tests (also known as
end-to-end tests or system tests).

## Vision

Lacewing is Fuchsia's unified host-driven testing framework. It's designed to
serve users both in-tree and out-of-tree.

At a high level, Lacewing aims to:

- Eliminate host-driven test framework fragmentation

- Improve host-driven test stability and reliability

- Centralize host-target interaction to versioned and officially supported
  APIs

- Lower the barrier of entry for host-driven test development

## Getting started

See [Getting Started](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/src/testing/end_to_end/README.md#getting-started-30-mins).

## Example tests

The Fuchsia repository contains several example tests in
[`//src/testing/end_to_end/examples/`](https://cs.opensource.google/fuchsia/fuchsia/+/main:src/testing/end_to_end/examples/) demonstrating different
Lacewing capabilities:

- **[Hello World Test](https://cs.opensource.google/fuchsia/fuchsia/+/main:src/testing/end_to_end/examples/hello_world_test/)**: Demonstrates basic test
  structure, DUT connection, and built-in health checks.

- **[FIDL Hello World Test](https://cs.opensource.google/fuchsia/fuchsia/+/main:src/testing/end_to_end/examples/fidl_hello_world_test/)**: Demonstrates direct FIDL
  protocol communication with on-device services using Fuchsia Controller.

- **[Data Resource Access Test](https://cs.opensource.google/fuchsia/fuchsia/+/main:src/testing/end_to_end/examples/data_resource_access_test/)**: Demonstrates
  packaging and reading custom test data files at runtime.

- **[Test Cases Example](https://cs.opensource.google/fuchsia/fuchsia/+/main:src/testing/end_to_end/examples/test_cases_example/)** : Demonstrates structuring
  reusable test logic using `FuchsiaTestCases`.

- **[Soft Reboot Test](https://cs.opensource.google/fuchsia/fuchsia/+/main:src/testing/end_to_end/examples/test_soft_reboot/)**: Demonstrates rebooting a Fuchsia
  device and verifying recovery.

- **[Power Cycle Test](https://cs.opensource.google/fuchsia/fuchsia/+/main:src/testing/end_to_end/examples/power_cycle_test/)**: Demonstrates hard power cycling
  via auxiliary hardware (DMC/PDU).

- **[Multi-Device Test](https://cs.opensource.google/fuchsia/fuchsia/+/main:src/testing/end_to_end/examples/multi_device_test/)**: Demonstrates coordinating tests
  across multiple devices in a testbed.

To run example tests locally on a Fuchsia emulator:

    # Include example tests in build configuration
    fx set core.x64 --with //src/testing/end_to_end/examples
    # Start emulator (if not already running)
    ffx emu start --headless
    # Run specific example test
    fx test //src/testing/end_to_end/examples/hello_world_test --e2e --output
    fx test //src/testing/end_to_end/examples/fidl_hello_world_test --e2e --output

For more detailed setup and execution instructions, see the
[Examples README](https://cs.opensource.google/fuchsia/fuchsia/+/main:src/testing/end_to_end/examples/README.md).

## Coding guidelines

See [Honeydew Contribution](https://cs.opensource.google/fuchsia/fuchsia/+/main:src/testing/end_to_end/honeydew#Contributing).
[](https://issues.fuchsia.dev/issues/new?component=1439230&template=1881640&description=Issue+on:+https://fuchsia.dev/docs/reference/testing/lacewing.md "Report a bug or suggest improvements on this page") [](https://cs.opensource.google/fuchsia/fuchsia/+/main:docs/reference/testing/lacewing.md "View the source code of this page") [](https://ci.android.com/edit?repo=fuchsia/fuchsia/main&file=docs/reference/testing/lacewing.md&cloneRepo=fuchsia/fuchsia:refs/heads/main&fullPath=fuchsia/docs/reference/testing/lacewing.md "Edit the source code of this page")