Skip to content
Snippets Groups Projects
Commit 989b7db0 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Ensure that android.test tests pass" am: 156775fe am:...

Merge "Merge "Ensure that android.test tests pass" am: 156775fe am: 34dc5a58 am: e211119f" into oc-dr1-dev-plus-aosp
parents 61f85098 aa7f42c5
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,13 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
# We only want this apk build for tests.
#
# Run the tests using the following commands:
# adb -r install ${ANDROID_PRODUCT_OUT}/data/app/FrameworkTestRunnerTests/FrameworkTestRunnerTests.apk
# 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
......
......@@ -29,9 +29,7 @@ public class TestCaseUtilTest extends TestCase {
List<String> testCaseNames = TestCaseUtil.getTestCaseNames(testSuite, false);
assertEquals(2, testCaseNames.size());
assertTrue(testCaseNames.get(0).endsWith("OneTestTestCase"));
assertTrue(testCaseNames.get(1).endsWith("OneTestTestSuite"));
assertEquals(0, testCaseNames.size());
}
public void testGetTestCaseNamesForTestCaseWithSuiteMethod() throws Exception {
......
......@@ -135,10 +135,23 @@ public class TestSuiteBuilderTest extends TestCase {
TestSuite testSuite = new OuterTest().buildTestsUnderHereRecursively();
assertContentsInOrder(getTestCaseNames(testSuite),
"testOuter", "testErrorOne", "testErrorTwo", "testFailOne", "testFailTwo",
"testInstrumentation", "testLevel1", "testLevel2", "testAnotherOne",
"testSimpleOne", "testSimpleTwo", "testNonSmoke", "testSmoke", "testSubclass",
"testSuperclass", "testUnSuppressedMethod");
"testOuter",
"testPublicConstructor",
"testErrorOne",
"testErrorTwo",
"testFailOne",
"testFailTwo",
"testInstrumentation",
"testLevel1",
"testLevel2",
"testAnotherOne",
"testSimpleOne",
"testSimpleTwo",
"testNonSmoke",
"testSmoke",
"testSubclass",
"testSuperclass",
"testUnSuppressedMethod");
}
private void assertContentsInOrder(List<String> actual, String... source) {
......
......@@ -18,6 +18,7 @@ package android.test.suitebuilder.examples.error;
import junit.framework.TestCase;
@RunAsPartOfSeparateTest
public class ErrorTest extends TestCase {
public void testErrorOne() throws Exception {
......
......@@ -18,6 +18,7 @@ package android.test.suitebuilder.examples.error;
import junit.framework.TestCase;
@RunAsPartOfSeparateTest
public class FailingTest extends TestCase {
public void testFailOne() throws Exception {
......
/*
* Copyright (C) 2017 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.
*/
package android.test.suitebuilder.examples.error;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation that marks tests that should only be run as part of a separate test and not on their
* own.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface RunAsPartOfSeparateTest {
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment