TestMapping

public class TestMapping
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.testmapping.TestMapping


用於載入 TEST_MAPPING 檔案的類別。

摘要

欄位

public static final Pattern MAINLINE_REGEX

public static final String TEST_SOURCES

公用建構函式

TestMapping(Path path, Path testMappingsDir)

建構函式,可從 TEST_MAPPING 檔案的路徑建立 TestMapping 物件。

公用方法

static File extractTestMappingsZip(File testMappingsZip)

解壓縮 ZIP 檔案,並傳回包含已解壓縮檔案內容的目錄。

static getAllTests(File testMappingsDir)

輔助程式可從指定目錄中尋找 TEST_MAPPING 檔案中的所有測試。

static Matcher getMainlineTestModuleName(TestInfo info)

取得參數化主線測試的比對工具的輔助程式。

getTests(String testGroup, disabledTests, boolean hostOnly, keywords)

輔助程式,可取得特定群組在 TEST_MAPPING 檔案中設定的所有測試。

static getTests(IBuildInfo buildInfo, String testGroup, boolean hostOnly, keywords)

輔助程式,用於在所有 TEST_MAPPING 檔案中尋找所有測試。

static void listTestMappingFiles(Path testMappingDir, Path testMappingsRootDir, filePaths)

輔助程式可列出所有測試對應檔案,並尋找所有父目錄和相關匯入路徑。

static void setIgnoreTestMappingImports(boolean ignoreTestMappingImports)

在 TestMapping 中設定 mIgnoreTestMappingImports。

static void setTestMappingPaths( relativePaths)

設定 TEST_MAPPINGS_ZIP 內的 TEST_MAPPING 路徑,以限制 TEST_MAPPING 的載入。

欄位

MAINLINE_REGEX

public static final Pattern MAINLINE_REGEX

TEST_SOURCES

public static final String TEST_SOURCES

公用建構函式

TestMapping

public TestMapping (Path path, 
                Path testMappingsDir)

建構函式,可從 TEST_MAPPING 檔案的路徑建立 TestMapping 物件。

參數
path Path:TEST_MAPPING 檔案的 ERROR(/Path)

testMappingsDir Path:建構作業的所有 TEST_MAPPING 檔案的資料夾 ERROR(/Path)

公用方法

extractTestMappingsZip

public static File extractTestMappingsZip (File testMappingsZip)

解壓縮 ZIP 檔案,並傳回包含已解壓縮檔案內容的目錄。

參數
testMappingsZip File:要擷取的測試對應項目 ZIP 檔案的 ERROR(/File)

傳回
File ERROR(/File) 指向測試對應項目 ZIP 檔案的暫存目錄。

getAllTests

public static  getAllTests (File testMappingsDir)

輔助程式,用於從指定目錄中尋找 TEST_MAPPING 檔案中的所有測試。

參數
testMappingsDir FileERROR(/File) 是包含所有測試對應檔案的目錄。

傳回
指定目錄及其子目錄中的測試 Map<String, Set<TestInfo>>

getMainlineTestModuleName

public static Matcher getMainlineTestModuleName (TestInfo info)

取得參數化主線測試的比對工具的輔助程式。

參數
info TestInfo

傳回
Matcher 用於參數化主線測試的 ERROR(/Matcher)

擲回
ConfigurationException

getTests

public  getTests (String testGroup, 
                 disabledTests, 
                boolean hostOnly, 
                 keywords)

輔助程式,可取得特定群組在 TEST_MAPPING 檔案中設定的所有測試。

參數
testGroup String:測試組的 String

disabledTests :一組 String,用於指定停用的測試名稱。

hostOnly boolean:如果只應傳回在主機上執行且不需要裝置的測試,請傳回 true。如果要傳回需要裝置才能執行的測試,請傳回 false。

keywords :在測試對應套件中篩選要執行的測試時,要比對的一組 String

傳回
測試資訊的 Set<TestInfo>

getTests

public static  getTests (IBuildInfo buildInfo, 
                String testGroup, 
                boolean hostOnly, 
                 keywords)

輔助程式,用於在所有 TEST_MAPPING 檔案中尋找所有測試。當套件執行作業需要針對特定群組 (例如提交前) 執行 TEST_MAPPING 檔案中的所有測試時,就需要使用此屬性。

參數
buildInfo IBuildInfo:描述建構作業的 IBuildInfo

testGroup String:測試組的 String

hostOnly boolean:如果只應傳回在主機上執行且不需要裝置的測試,請傳回 true。如果要傳回需要裝置才能執行的測試,請傳回 false。

keywords

傳回
在建構構件 test_mappings.zip 中設定的測試 Set<TestInfo>

listTestMappingFiles

public static void listTestMappingFiles (Path testMappingDir, 
                Path testMappingsRootDir, 
                 filePaths)

輔助程式可列出所有測試對應檔案,並尋找所有父目錄和相關匯入路徑。

參數
testMappingDir Path:指向 TEST_MAPPING 檔案父目錄的 ERROR(/Path)

testMappingsRootDir Path:建構作業的所有 TEST_MAPPING 檔案的資料夾 ERROR(/Path)

filePaths :用於儲存所有 TEST_MAPPING 路徑的 ERROR(/Set)

setIgnoreTestMappingImports

public static void setIgnoreTestMappingImports (boolean ignoreTestMappingImports)

在 TestMapping 中設定 mIgnoreTestMappingImports。

參數
ignoreTestMappingImports boolean:布林值,指出是否要在測試對應中忽略匯入項目。

setTestMappingPaths

public static void setTestMappingPaths ( relativePaths)

設定 TEST_MAPPINGS_ZIP 內的 TEST_MAPPING 路徑,以限制 TEST_MAPPING 的載入作業。

參數
relativePaths :相對於 TEST_MAPPINGS_ZIP 的 TEST_MAPPING 路徑的 List<String>