• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Copyright (C) 2009 The Android Open Source Project
3
4     Licensed under the Apache License, Version 2.0 (the "License");
5     you may not use this file except in compliance with the License.
6     You may obtain a copy of the License at
7
8          http://www.apache.org/licenses/LICENSE-2.0
9
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15-->
16
17<!--  Contains the schema definition for Android test definitions xml -->
18
19<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
20    targetNamespace="http://schemas.android.com/testrunner/test_defs/1.0"
21    xmlns="http://schemas.android.com/testrunner/test_defs/1.0"
22    elementFormDefault="qualified">
23
24    <xs:element name="test-definitions">
25        <xs:complexType>
26            <xs:sequence>
27                <xs:choice minOccurs="0" maxOccurs="unbounded">
28                    <xs:element name="test" type="javaTestType" />
29                    <xs:element name="test-native" type="nativeTestType" />
30                    <xs:element name="test-host" type="hostTestType" />
31                </xs:choice>
32            </xs:sequence>
33        </xs:complexType>
34    </xs:element>
35
36    <!-- Generic, abstract test definition. Contains attributes common to all
37    test types. -->
38    <xs:complexType name="testType">
39
40        <!-- Self-descriptive name used to uniquely identify the test. -->
41        <xs:attribute name="name" type="xs:string" use="required" />
42
43        <!-- File system path, relative to Android build root, to this
44        package's Android.mk file. -->
45        <xs:attribute name="build_path" type="xs:string" use="required" />
46
47        <!-- Include test in continuous test system. -->
48        <xs:attribute name="continuous" type="xs:boolean" use="optional"
49            default="false" />
50
51        <!-- Include test as part of named suite. -->
52        <xs:attribute name="suite" type="xs:string" use="optional" />
53
54        <!--  Short description (typically less than 60 characters) about this
55        test. -->
56        <xs:attribute name="description" type="xs:string" use="optional" />
57
58        <!--  Extra arguments to append to build command when building this
59        test. -->
60        <xs:attribute name="extra_build_args" type="xs:string"
61                    use="optional" />
62    </xs:complexType>
63
64    <!-- Java on device instrumentation test.
65
66      The test attributes map to the following commands:
67      (if class is defined)
68          adb shell am instrument -w <package>/<runner>
69      (else)
70          adb shell am instrument -w -e class <class> <package>/<runner>
71    -->
72    <xs:complexType name="javaTestType">
73        <xs:complexContent>
74            <xs:extension base="testType">
75
76                <!--  Android application package that contains the tests. -->
77                <xs:attribute name="package" type="xs:string" use="required" />
78
79                <!-- Fully qualified Java test class to run. -->
80                <xs:attribute name="class" type="xs:string" use="optional" />
81
82                <!-- Fully qualified InstrumentationTestRunner to execute. -->
83                <xs:attribute name="runner" type="xs:string" use="optional"
84                    default="android.test.InstrumentationTestRunner" />
85
86                <!-- Build name of Android package this test targets. These
87                targets are defined in the coverage_targets.xml file.  Used as
88                basis for code coverage metrics. If omitted, code coverage will
89                not be supported for this test. -->
90                <xs:attribute name="coverage_target" type="xs:string"
91                    use="optional" />
92
93            </xs:extension>
94        </xs:complexContent>
95    </xs:complexType>
96
97    <!-- Native (C/C++) on device tests.
98
99    The native test attributes map to the following commands:
100        make <build_path>/Android.mk <extra_build_args>
101        adb sync
102        for test_prog in <tests built>; do
103            adb shell "/system/bin/${test_prog} >/dev/null 2>&1;echo \$?"
104            adb shell "rm /system/bin/${test_prog}"
105        done
106    -->
107    <xs:complexType name="nativeTestType">
108        <xs:complexContent>
109            <xs:extension base="testType" />
110            <!-- no additional attributes -->
111        </xs:complexContent>
112    </xs:complexType>
113
114    <!-- Host java tests.
115
116    Uses hosttestlib to execute tests on host. Maps to following command:
117        java -cp <libs>:jar_name com.android.hosttest.DeviceTestRunner \
118            <class> -s <device serial> -p <app build path>
119    -->
120    <xs:complexType name="hostTestType">
121        <xs:complexContent>
122            <xs:extension base="testType">
123
124                <!--  The test class to run. Must extend DeviceTestSuite, and
125                implement a public static suite() method that returns a Test to
126                run. -->
127                <xs:attribute name="class" type="xs:string" use="required" />
128
129                <!-- built jar name of host library that includes the tests. -->
130                <xs:attribute name="jar_name" type="xs:string" use="required" />
131            </xs:extension>
132        </xs:complexContent>
133    </xs:complexType>
134</xs:schema>
135