tree: ebd7866c369aea7e97fc8262ca976ba7304e5f23 [path history] [tgz]
  3. default.shard.cml
  4. meta/
  5. src/
  6. test_data/
  7. tests/

Golang Test Runner

Reviewed on: 2020-08-11

Golang test runner is a test runner that launches a golang test binary as a component, parses its output, and translates it to the fuchsia.test.Suite protocol on behalf of the test.


fx set core.x64 --with //src/sys/test_runners/gotests
fx build


Examples to demonstrate how to write v2 test:

To run this example:

fx test go-test-runner-example


Test cases are executed concurrently (max 10 test cases at a time by default). Instruction to override.


Test authors can specify command line arguments to their tests in their component manifest file. These will be passed to the test when it is run.

Note the following known behavior change:

-test.failfast: As each test case is executed in a different process, this flag will only influence sub-tests.

The following flags are restricted and the test fails if any are passed as fuchsia.test.Suite provides equivalent functionality that replaces them

  • test.v
  • test.parallel
  • test.count


Test Enumeration

Only top level tests can be enumerated. Golang doesn't give us a way to enumerate sub-tests.

Disabled Tests

There is no way in golang to enumerate or force-run disabled tests, so all the tests will be marked as enabled when enumerated.



fx test go-test-runner-unit-test
fx test go_runner_integration_test

Source layout

The entry-point is located in src/, the FIDL service implementation and all the test logic exists in src/ Unit tests are co-located with the implementation.