1 /* 2 * Copyright (C) 2010 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 package com.android.cts.tradefed.testtype; 18 19 import com.android.ddmlib.testrunner.TestIdentifier; 20 import com.android.tradefed.testtype.IAbi; 21 import com.android.tradefed.testtype.IRemoteTest; 22 23 import java.io.File; 24 import java.util.Collection; 25 26 /** 27 * Container for CTS test info. 28 * <p/> 29 * Knows how to translate this info into a runnable {@link IRemoteTest}. 30 */ 31 public interface ITestPackageDef extends Comparable<ITestPackageDef> { 32 33 /** 34 * Get the id of the test package. 35 * @return the {@link String} id 36 */ 37 public String getId(); 38 39 /** 40 * Creates a runnable {@link IRemoteTest} from info stored in this definition. 41 * 42 * @param testCaseDir {@link File} representing directory of test case data 43 * @return a {@link IRemoteTest} with all necessary data populated to run the test or 44 * <code>null</code> if test could not be created 45 */ 46 public IRemoteTest createTest(File testCaseDir); 47 48 /** 49 * Get the collection of tests in this test package. 50 */ 51 public Collection<TestIdentifier> getTests(); 52 53 /** 54 * Return the sha1sum of the binary file for this test package. 55 * <p/> 56 * Will only return a valid value after {@link #createTest(File)} has been called. 57 * 58 * @return the sha1sum in {@link String} form 59 */ 60 public String getDigest(); 61 62 /** 63 * @return the name of this test package. 64 */ 65 public String getName(); 66 67 /** 68 * @return the ABI of this test package. 69 */ 70 public IAbi getAbi(); 71 72 /** 73 * Set the filter to use for tests 74 * 75 * @param testFilter 76 */ 77 public void setTestFilter(TestFilter testFilter); 78 79 /** 80 * Restrict this test package to run a specific class and method name 81 * 82 * @param className the test class to restrict this run to 83 * @param methodName the optional test method to restrict this run to, or <code>null</code> to 84 * run all tests in class 85 */ 86 public void setClassName(String className, String methodName); 87 88 /** 89 * Return the file name of this package's instrumentation target apk. 90 * 91 * @return the file name or <code>null</code> if not applicable. 92 */ 93 public String getTargetApkName(); 94 95 /** 96 * Return the Android package name of this package's instrumentation target, or 97 * <code>null</code> if not applicable. 98 */ 99 public String getTargetPackageName(); 100 101 } 102