Reviewed on: 2022-04-07
Gunit Runner is a test runner that launches a gunit binary as a component, parses its output, and translates it to fuchsia.test.Suite protocol on behalf of the test.
fx set core.x64 --with //src/sys/test_runners/gunit fx build
A test that needs additional capabilities can use a manifest like the following:
{
include: [
"//src/sys/test_runners/gunit/default.shard.cml",
],
program: {
binary: "bin/my_component_test",
},
// ... other capabilities
}
Test cases are executed sequentially by default. Instruction to override.
See passing arguments to learn more.
GUNIT_SKIP(), it will be recorded as Passed rather than as Skipped. This is due to a bug in gunit itself.We currently don't have a way of writing gunit tests. So we simulate those tests by converting gunit flags to gtest flags and then running the test using gtest framework.
Run:
fx test gunit_runner_tests fx test gunit-runner-integration-test fx test gunit-runner-smoke-test
Gtest and Gunit have identical output formats. They differ in name of the flags passed to test binary. All source code of this component is hosted in //src/sys/test_runners/gtest folder. This folder hosts configuration, build files and some test files.
The entrypoint is located in src/main.rs, the FIDL service implementation and all the test logic exists in src/test_server.rs. Unit tests are co-located with the implementation.