Execution of tests in Tradefed is conducted by test runners that allow the control of Android devices for necessary testing steps. Follow these sections in order.
1. Write a new test runner
Here you will learn the basics that go into writing a new Tradefed test runner. This is particularly useful if you plan to support a brand new type of test, and you need a new runner to be developed from scratch.
See Write a Tradefed test runner for instructions.
2. Write a shardable test runner
You may also learn how to make your test runner shardable. A shardable test runner allows the infrastructure to distribute the full test execution over several devices (collocated or not). This is useful when the corpus of tests is large, and you want to parallelize the execution and speed completion.
See Write a sharded IRemoteTest test runner for steps.
3. Write a host-driven test
Host-driven tests are a common use case where test execution is driven from the host-side and queries the device as needed for the test. This is useful when device operation required by the test affects the device state itself, for example rebooting the device.
The test runner type can be used within Tradefed or when running through a suite.
See Write a host-driven test in Trade Federation for instructions.
4. Report metrics from tests
It's fairly common for a test to report metrics in addition to the execution results. Depending on the test runner, there are several methods to report the metrics.
See Report metrics or data from a Tradefed test for examples.
5. Automated log collection
Some logs are commonly used for debugging issues, for example: Logcat. So Tradefed offers an automated mechanism to collect them easily.
See Automated log on failure collection for use.
6. Automatic test retry
You may enable Tradefed to automatically retry failures or run some tests several times in iterations.
See Automatic test retry for more details.
7. Retry isolation
You may enable Tradefed to attempt to isolate the test execution between retry attempts.
See Retry isolation for more details.