40 lines
1.4 KiB
Makefile
Raw Normal View History

# Copyright 2010, 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.
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
# We only want this apk build for tests.
Ensure that android.test tests pass It looks as though the tests in test-runner/tests have not actually been run successfully for over 7 years. As a result they have degraded. This change fixes the tests so that they will pass and provides instructions on how to run them. TestCaseUtilTest.testGetTestCaseNamesForTestSuiteWithSuiteMethod This fails because it expected 2 names to be returned but only returns 0. The reason for that is although TwoTestsInTestSuite has a Test suite() method that does create a TestSuite with two tests the TestCaseUtil method does not actually call suite(). Instead, because TwoTestsInTestSuite is a TestSuite it just calls the tests() method on it which returns an empty Enumeration because TwoTestsInTestSuite is empty. The support for "static Test suite() {}" is broken but fixing this will affect the behavior of InstrumentationTestRunner which is used in thousands of different places both in and outside Google and so could cause untold problems. TestSuiteBuilderTest.testIncludeAllPackagesUnderHere Reformat the list, one per line and then add missing name "testPublicConstructor". ErrorTest/FailingTest These tests are not meant to be run on their own, only as part of a separate test. The RunAsPartOfSeparateTest annotation was added to allow these to be excluded using notAnnotation as shown in the instructions for running the tests. Bug: 30188076 Test: followed new instructions in test-runner/tests/Android.mk Change-Id: I60e7bee9cd08a9ab7777a2578fc58da772de5c1f
2017-06-22 12:52:18 +01:00
#
# Run the tests using the following commands:
Clean up ClassPathPackageInfoSource Part of the work of removing JUnit and dependent android.test classes from the Android API involves providing a static library that developers can include in their test applications to ease migration. That library will be built directly from the source (as opposed to android.jar which is built from stubs) and so developers will be able to see classes and methods that are not present in the stubs. This change is one of a number of similar changes that cleanup the existing non-API code in order to minimize the additional methods and classes exposed externally. The basic approach is to remove unused classes and methods, use least visible access modifier possible and generally minimize the amount of publicly visible code. PackageInfoSources only provided a static field and accessor method so they were moved into ClassPathPackageInfoSource and PackageInfoSources was removed. ClassPathPackageInfo was only used in ClassPathPackageInfoSource and in TestGrouping. In the latter it was simply used as an intermediate value between ClassPathPackageInfoSource.getPackage(String packageName) and ClassPathPackageInfo.getTopLevelClassesRecursive(String packageName). Moving that method into ClassPathPackageInfoSource allowed the ClassPathPackageInfo to become an inner class of ClassPathPackageInfoSource. As it is an inner class it no longer needed an explicit reference to the containing ClassPathPackageInfoSource. Bug: 30188076 Test: make checkbuild and ran FrameworkTestRunnerTests Change-Id: Idb0b6a585030805b9cff8562abb93b7e5920c53a
2017-06-20 16:18:07 +01:00
# adb install -r ${ANDROID_PRODUCT_OUT}/data/app/FrameworkTestRunnerTests/FrameworkTestRunnerTests.apk
Ensure that android.test tests pass It looks as though the tests in test-runner/tests have not actually been run successfully for over 7 years. As a result they have degraded. This change fixes the tests so that they will pass and provides instructions on how to run them. TestCaseUtilTest.testGetTestCaseNamesForTestSuiteWithSuiteMethod This fails because it expected 2 names to be returned but only returns 0. The reason for that is although TwoTestsInTestSuite has a Test suite() method that does create a TestSuite with two tests the TestCaseUtil method does not actually call suite(). Instead, because TwoTestsInTestSuite is a TestSuite it just calls the tests() method on it which returns an empty Enumeration because TwoTestsInTestSuite is empty. The support for "static Test suite() {}" is broken but fixing this will affect the behavior of InstrumentationTestRunner which is used in thousands of different places both in and outside Google and so could cause untold problems. TestSuiteBuilderTest.testIncludeAllPackagesUnderHere Reformat the list, one per line and then add missing name "testPublicConstructor". ErrorTest/FailingTest These tests are not meant to be run on their own, only as part of a separate test. The RunAsPartOfSeparateTest annotation was added to allow these to be excluded using notAnnotation as shown in the instructions for running the tests. Bug: 30188076 Test: followed new instructions in test-runner/tests/Android.mk Change-Id: I60e7bee9cd08a9ab7777a2578fc58da772de5c1f
2017-06-22 12:52:18 +01:00
# adb shell am instrument \
-e notAnnotation android.test.suitebuilder.examples.error.RunAsPartOfSeparateTest \
-w com.android.frameworks.testrunner.tests/android.test.InstrumentationTestRunner
#
LOCAL_MODULE_TAGS := tests
LOCAL_JAVA_LIBRARIES := android.test.runner android.test.base android.test.mock
LOCAL_STATIC_JAVA_LIBRARIES := junit
# Include all test java files.
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := FrameworkTestRunnerTests
# Because of android.test.mock.
LOCAL_PRIVATE_PLATFORM_APIS := true
include $(BUILD_PACKAGE)