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

Writing a Shell Test in Trade Federation

This page describes how to write a shell test. If a test can be done with a shell script, you can run it with ExecutableHostTest. ExecutableHostTest supports test filtering and test sharding.

Writing a shell test

Your main shell script runs on the host. Other scripts or binaries to run on the device and the data files required must be pushed to the device first. This can be done as part of the main script or using PushFilePreparer.

The test result for each test is based on the exit status of your main script. A test can timeout if per-binary-timeout has been specified.

Configuring a shell test

In Tradefed XML configuration, shell tests are run through the ExecutableHostTest runner.

<test class="com.android.tradefed.testtype.binary.ExecutableHostTest" >
    <option name="binary" value="your-test-script.sh" />
    <option name="relative-path-execution" value="true" />
    <option name="per-binary-timeout" value="15m" />
</test>

Set the main script for the test as the value of the binary option. Check out other ExecutableHostTest options.

If the script requires root privilege, add RootTargetPreparer to the configuration.