1page.title=Test Lifecycle
2@jd:body
3
4<!--
5    Copyright 2013 The Android Open Source Project
6
7    Licensed under the Apache License, Version 2.0 (the "License");
8    you may not use this file except in compliance with the License.
9    You may obtain a copy of the License at
10
11        http://www.apache.org/licenses/LICENSE-2.0
12
13    Unless required by applicable law or agreed to in writing, software
14    distributed under the License is distributed on an "AS IS" BASIS,
15    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16    See the License for the specific language governing permissions and
17    limitations under the License.
18-->
19
20<p>The lifecycle of a test executed using TradeFederation is composed of four separate stages, designed
21around formally defined interfaces.</p>
22<ul>
23<li><a href="/reference/com/android/tradefed/build/IBuildProvider.html"
24  >Build Provider</a>: Provides a build to test, downloading appropriate files if necessary</li>
25<li><a href="/reference/com/android/tradefed/targetprep/ITargetPreparer.html"
26  >Target Preparer</a>: Prepares the test environment, possibly including software installation and
27  device configuration</li>
28<li><a href="/reference/com/android/tradefed/testtype/IRemoteTest.html"
29  >Test</a>: Executes test(s) and gathers test results.  This may be any JUnit Test, although our
30  <a href="/reference/com/android/tradefed/testtype/IRemoteTest.html"
31  >IRemoteTest</a> interface is specifically designed to work well in the Trade Federation
32  environment.</li>
33<li><a href="/reference/com/android/tradefed/result/ITestInvocationListener.html"
34  >Test Invocation Listener</a>: Listens for test results, usually for the purpose of forwarding the
35  test results to a repository or displaying them to the Test Runner</li>
36</ul>
37
38<p>The fundamental testing entity in TF is a <b>Configuration</b> (config). A config is an XML file
39that declares the lifecycle components of a test.</p>
40
41<p>This separation of the test's lifecycle is intended to allow for reuse.  Using this design, the
42Developer can create a Test once, and then the Integrator can create different Configurations to
43run that Test in different environments. For example,
44they could create a Configuration that will run a test on a local machine and dump the result to
45stdout.  They could then create a second Configuration that would execute that same test, but use a
46different Test Invocation Listener to store the test results in a database.  A third Configuration
47might be designed run that test continuously from a test lab somewhere.</p>
48
49<p>It's convenient to note here that a Configuration along with its command-line arguments (as
50provided by the Test Runner) is known as a <b>Command</b>.  When TF takes pairs a Command with an
51<code>ITestDevice</code> and executes it, the subsequent object is known as an <b>Invocation</b>.
52In short, an Invocation encompasses a complete TF test execution, across its entire lifecycle.</p>
53
54<h3>Additional Components of a Configuration</h3>
55<ul>
56<li><a href="/reference/com/android/tradefed/device/IDeviceRecovery.html"
57  >Device Recovery</a>: mechanism to recover device communication if lost</li>
58<li><a href="/reference/com/android/tradefed/log/package-summary.html">Logger</a>: collects tradefed logging data</li>
59</ul>
60
61