summaryrefslogtreecommitdiffstats
path: root/testrunner/tests
diff options
context:
space:
mode:
authorBrett Chabot <brettchabot@android.com>2009-10-21 11:16:42 -0700
committerBrett Chabot <brettchabot@android.com>2009-10-21 11:19:12 -0700
commit34fb7f6b0c1e8375f168e5a9d4e5c7a93d4ecd7f (patch)
treefb8b1848e771c27d1298e2f6f4ea3c7ee4415871 /testrunner/tests
parentec59a8834bbca256495045a6687a672f66b52df0 (diff)
downloadandroid_development-34fb7f6b0c1e8375f168e5a9d4e5c7a93d4ecd7f.tar.gz
android_development-34fb7f6b0c1e8375f168e5a9d4e5c7a93d4ecd7f.tar.bz2
android_development-34fb7f6b0c1e8375f168e5a9d4e5c7a93d4ecd7f.zip
Add ability to retrieve instrumentations from android_manifest parser.
Also add a simple unit test for the parser.
Diffstat (limited to 'testrunner/tests')
-rw-r--r--testrunner/tests/AndroidManifest.xml30
-rwxr-xr-xtestrunner/tests/android_manifest_tests.py42
2 files changed, 72 insertions, 0 deletions
diff --git a/testrunner/tests/AndroidManifest.xml b/testrunner/tests/AndroidManifest.xml
new file mode 100644
index 000000000..e867f730f
--- /dev/null
+++ b/testrunner/tests/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Sample manifest file used for unit testing -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.tests">
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="com.example.android"
+ android:label="Tests"/>
+
+</manifest>
diff --git a/testrunner/tests/android_manifest_tests.py b/testrunner/tests/android_manifest_tests.py
new file mode 100755
index 000000000..2817726c4
--- /dev/null
+++ b/testrunner/tests/android_manifest_tests.py
@@ -0,0 +1,42 @@
+#!/usr/bin/python2.4
+#
+#
+# Copyright 2009, The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+import unittest
+sys.path.append('../..')
+
+from testrunner import android_manifest
+
+
+class AndroidManifestTest(unittest.TestCase):
+ """Unit tests for AndroidManifest."""
+
+ def setUp(self):
+ """Create android_mainfest for testing from sample file."""
+ self._manifest = android_manifest.AndroidManifest(app_path='.')
+
+ def testGetPackageName(self):
+ self.assertEquals('com.example.android.tests',
+ self._manifest.GetPackageName())
+
+ def testGetInstrumentationNames(self):
+ self.assertEquals(['android.test.InstrumentationTestRunner'],
+ self._manifest.GetInstrumentationNames())
+
+
+if __name__ == '__main__':
+ unittest.main()