The Trade Federation Console is an optional component that allows you to inspect the state of Trade Federation and what it sees, from the device states to the current tests in progress.
It is a great tool for monitoring a large number of tests running in parallel and understanding the progress of each test.
Reach the console
Once Tradefed is built, the tradefed.sh
launcher script is accessible from
your path and by default will take you to the console.
The console presents itself with the tf >
prompt.
What can the console do?
The help
of the console will always list the most up-to-date information.
A few interesting features of it are:
- List the devices and how Tradefed sees their state:
list devices
- List the currently running invocations and their metadata:
list invocations
- Get the logs of all running invocations and Tradefed:
dump logs
The console allows you to debug what is happening in Tradefed and the devices by querying some states that are not shown together anywhere else.
How do I disable the console?
Sometimes the console isn't needed, such as when running a one-time command. The console must be disabled when running Tradefed from a script or when piping its output directly. Running Tradefed from a script with the console enabled can cause unexpected behavior.
To prevent the console from starting, run the tradefed.sh
launcher script with
the commandAndExit
argument.
tradefed.sh run commandAndExit <usual command>
Console autocompletion
The console provides basic autocompletion of configuration names.
tf > run <hit TAB>
result in:
Display all 167 possibilities? (y or n)
By hitting TAB after the run
you can get the full list of configurations
available. And if you have a partial name already typed in, the console will
print all the possibilities.
tf >run tf/<HIT TAB>
tf/acceptance tf/fake tf/func
tf/stress tf/uiautomator tf/unit-runner
tf >run tf/
This is a useful when you don't remember an exact configuration name.