Google is committed to advancing racial equity for Black communities. See how.

fx test

Entry point for all Fuchsia tests (host, target and end-to-end)

Usage: fx test [testName ...]

Options:
-h, --help
    --host                     If true, only runs host tests. The opposite of `--device`
-d, --device                   If true, only runs device tests. The opposite of `--host`
-p, --package                  Matches tests against their Fuchsia package Name
-c, --component                Matches tests against their Fuchsia component Name. When
                               --package is also specified, results are filtered both by package
                               and component.
-a, --and                      When present, adds additional requirements to the preceding
                               `testName` filter
    --printtests               If true, prints the contents of `//out/default/tests.json`
    --[no-]build               If true, invokes `fx build` before running the test suite
                               (defaults to on)
    --[no-]restrict-logs       If true, passes a flag of the same name to the component test runner
    --[no-]updateifinbase      If true, invokes `fx update-if-in-base` before running device tests
                               (defaults to on)
    --[no-]use-package-hash    If true, uses the package Merkle root hash from the build artifacts when executing device tests
                               (defaults to on)
    --info                     If true, prints the test specification in key:value format, and exits
-r, --random                   If true, randomizes test execution order
    --fuzzy                    The Levenshtein distance threshold to use when generating suggestions
                               (defaults to "3")
    --dry                      If true, does not invoke any tests
-f, --fail                     If true, halts test suite execution on the first failed test
    --[no-]log                 If true, emits all output from all tests to a file. Turned on
                               when running real tests unless `--no-log` is passed.
    --logpath                  If passed and if --no-log is not passed, customizes the
                               destination of the log artifact.

                               Defaults to a timestamped file at the root of //out/default.
    --limit                    If passed, ends test suite execution after N tests
-s, --slow                     When set to a non-zero value, triggers output for any test that
                               takes longer than N seconds to execute.

                               Note: This has no impact if the -o flag is also set.
                               Note: The -s flag used to be an abbreviation for --simple.
                               (defaults to "2")
-R, --realm                    If passed, runs the tests in a named realm instead of a
                               randomized
                               one.
    --min-severity-logs        Filters log output to only messages with this for device tests.Valid severities: TRACE, DEBUG, INFO, WARN, ERROR, FATAL.
    --[no-]exact               If true, does not perform any fuzzy-matching on tests
    --[no-]e2e                 If true, allows the execution of host tests that require a connected device or emulator, such as end-to-end tests.
    --[no-]only-e2e            If true, skips all non-e2e tests. The `--e2e` flag is redundant when passing this flag.
    --skipped                  If true, prints a debug statement about each skipped test.

                               Note: The old `-s` abbreviation now applies to `--simple`.
    --simple                   If true, removes any color or decoration from output
-o, --output                   If true, also displays the output from passing tests
-u, --silenceunsupported       If true, will reduce unsupported tests to a warning and continue
                               executing. This is dangerous outside of the local development
                               cycle, as "unsupported" tests are likely a problem with this
                               command and not the tests.
-v, --verbose

Examples:

  - Execute all tests
  fx test

  - Execute the test component available at this URL
  fx test fuchsia-pkg://fuchsia.com/myPackageName/#meta/componentName.cmx

  - Execute the test whose package URL's `package-name` component matches
    the value. Runs all tests contained in this package.
  fx test myPackageName

  - Execute the test whose package URL's `resource-path` component matches
    the value. Runs only that test out of its containing package.
  fx test componentName

  - Execute all tests at and below this path (usually host tests)
  fx test //subtree/path

  - Multiple test names can be supplied in the same invocation, e.g.:
  fx test //subtree/path //another/path fuchsia-pkg://...

The value(s) supplied for `testName` can be fully-formed Fuchsia Package URLs,
Fuchsia package names, or Fuchsia-tree directories. Partial tree paths
will execute all descendent tests.

test source code