This guide provides instructions on how to run an end-to-end test for testing a Fuchsia product.
screen_is_not_black_test end-to-end test reboots a device under test
(DUT), waits 100 seconds, and takes a snapshot of the device’s screen. If the
snapshot image is not a black screen, the test concludes that Fuchsia is
successfully up and running on the device after reboot.
To run this example end-to-end test:
- Build a Fuchsia image to include the end-to-end test
- Start the emulator with the Fuchsia image
- Run the end-to-end test
Verify the following requirements:
- Set up your Fuchsia development environment (see Get Fuchsia source code).
Configure an IPv6 network for the emulator:
sudo ip tuntap add dev qemu mode tap user $USER sudo ifconfig qemu up
Build a Fuchsia image to include the end-to-end test
Before you can run the
screen_is_not_black_test end-to-end test, you first
need to build your Fuchsia image to include the test in the build artifacts:
To add the end-to-end test, run the
fx setcommand with the following
fx set workstation.qemu-x64 --with //src/tests/end_to_end/screen_is_not_black:test
//src/tests/end_to_end/screen_is_not_blackis a test directory in the Fuchsia source tree. The
BUILD.gnfile in this directory defines the
testtarget to include the
screen_is_not_black_testend-to-end test in the build artifacts.
Build your Fuchsia image:
fx build command completes, the build artifacts now include the
screen_is_not_black_test end-to-end test, which you can run from your host
Start the emulator with the Fuchsia image
Start the emulator with your newly built Fuchsia image and run a package repository server:
In a new terminal, start the emulator:
fx emu -N
fx emucommand starts the emulator with a Fuchsia image from your default build directory.
fx set-devicecommand and select
step-atom-yard-juicy(the emulator’s default device name) to be your device, for example:
$ fx set-device Multiple devices found, please pick one from the list: 1) rabid-snort-wired-tutu 2) step-atom-yard-juicy #? 2 New default device: step-atom-yard-juicy
In another new terminal, start a package server:
fx servecommand continues to run as a package server for the device.
Run the end-to-end test
screen_is_not_black_test end-to-end test:
fx run-e2e-tests screen_is_not_black_test
When the test passes, this
fx command prints the following output in the end:
Saw a screen that is not black. [FINE]: Running over ssh: killall sl4f.cmx 01:04 +1: All tests passed! 1 of 1 test passed
Run any end-to-end test
fx run-e2e-tests command to run an end-to-end test from your host
fx run-e2e-tests <TEST_NAME>
Some product configurations may include a set of end-to-end tests by default. However, if you want to run an end-to-end test that is not part of your product configuration, configure and build your Fuchsia image to include the specific test:
fx set <PRODUCT>.<BOARD> --with <TEST_DIRECTORY:TARGET> fx build
For example, the following command configures your build artifacts to include
all the end-to-end tests in the
fx set workstation.qemu-x64 --with //src/tests/end_to_end/perf:test
For the list of all available end-to-end tests in the Fuchsia repository, see the //src/tests/end_to_end directory.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-03-19.