Change build targets for settings tests

1. Split existing tests into fully automatable (unit/) and not fully
automatable (app/)
2. Revert previous changes to test runners on app/
3. Fix some typos in readme

This will enable us to add the fully automatable test target
SettingsUnitTests to the continuous integration tests on the platform.

Change-Id: I0f42c59fde84891e4bfc379150c2f0c61ce1329f
This commit is contained in:
Benjamin Franz
2016-01-21 12:27:36 +00:00
parent 11805d159c
commit d11b713a9f
104 changed files with 98 additions and 37 deletions

View File

@@ -1,19 +1,5 @@
LOCAL_PATH:= $(call my-dir) LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
# We only want this apk build for tests. # Include all makefiles in subdirectories
LOCAL_MODULE_TAGS := tests include $(call all-makefiles-under,$(LOCAL_PATH))
LOCAL_CERTIFICATE := platform
LOCAL_JAVA_LIBRARIES := android.test.runner bouncycastle
LOCAL_STATIC_JAVA_LIBRARIES := android-support-test mockito-target
# Include all test java files.
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := SettingsTests
LOCAL_INSTRUMENTATION_FOR := Settings
include $(BUILD_PACKAGE)

View File

@@ -1,17 +0,0 @@
To build the tests you can use the following command at the root of your android source tree
$ make SettingsTests
The test apk then needs to be installed onto your test device via for example
$ adb install -r out/target/product/shamu/data/app/SettingsTests/SettingsTests.apk
To run all tests:
$ adb shell am instrument -w com.android.settings.tests/android.support.test.runner.AndroidJUnitRunner
To run all tests in a specific class:
$ adb shell am instrument -w -e class com.android.managedprovisioning.<class> com.android.managedprovisioning.tests/android.test.InstrumentationTestRunner
To run a specific test:
$ adb shell am instrument -w -e class com.android.settings.<class> com.android.settings.tests/android.support.test.runner.AndroidJUnitRunner
More general information can be found at
http://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html

17
tests/app/Android.mk Normal file
View File

@@ -0,0 +1,17 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
# We only want this apk build for tests.
LOCAL_MODULE_TAGS := tests
LOCAL_CERTIFICATE := platform
LOCAL_JAVA_LIBRARIES := android.test.runner bouncycastle
# Include all test java files.
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := SettingsTests
LOCAL_INSTRUMENTATION_FOR := Settings
include $(BUILD_PACKAGE)

View File

@@ -51,9 +51,14 @@
</activity> </activity>
</application> </application>
<instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" <instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.android.settings" android:targetPackage="com.android.settings"
android:label="Settings Test Cases"> android:label="Settings App Tests">
</instrumentation>
<instrumentation android:name="SettingsLaunchPerformance"
android:targetPackage="com.android.settings"
android:label="Settings Launch Performance">
</instrumentation> </instrumentation>
</manifest> </manifest>

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

19
tests/unit/Android.mk Normal file
View File

@@ -0,0 +1,19 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
# We only want this apk build for tests.
LOCAL_MODULE_TAGS := tests
LOCAL_CERTIFICATE := platform
LOCAL_JAVA_LIBRARIES := android.test.runner
LOCAL_STATIC_JAVA_LIBRARIES := android-support-test mockito-target
# Include all test java files.
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := SettingsUnitTests
LOCAL_INSTRUMENTATION_FOR := Settings
include $(BUILD_PACKAGE)

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.settings.tests.unit">
<application>
<uses-library android:name="android.test.runner" />
</application>
<instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.settings"
android:label="Settings Test Cases">
</instrumentation>
</manifest>

Some files were not shown because too many files have changed in this diff Show More