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_MAPPINGS_ZIP

public static final String TEST_SOURCES

公用建構函式

TestMapping()

用於初始化空白 TestMapping 物件的建構函式。

TestMapping( testMappingRelativePaths, boolean ignoreTestMappingImports)

用來建立 TestMapping 物件的建構函式。

公用方法

static File extractTestMappingsZip(File testMappingsZip)

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

getAllTests(File testMappingsDir)

協助從指定目錄找出 TEST_MAPPING 檔案中所有測試的輔助工具。

static Matcher getMainlineTestModuleName(TestInfo info)

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

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

輔助程式會根據裝置版本中的構件,在所有 TEST_MAPPING 檔案中尋找所有測試。

getTests(IBuildInfo buildInfo, String testGroup, boolean hostOnly, keywords, ignoreKeywords, extraZipNames, matchedPatternPaths)

根據指定的構件,在所有 TEST_MAPPING 檔案中尋找所有測試的輔助程式。

void listTestMappingFiles(Path testMappingDir, Path testMappingsRootDir, filePaths)

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

欄位

MAINLINE_REGEX

public static final Pattern MAINLINE_REGEX

TEST_MAPPINGS_ZIP

public static final String TEST_MAPPINGS_ZIP

TEST_SOURCES

public static final String TEST_SOURCES

公用建構函式

測試對應

public TestMapping ()

用於初始化空白 TestMapping 物件的建構函式。

TestMapping

public TestMapping ( testMappingRelativePaths, 
                boolean ignoreTestMappingImports)

用於建立 TestMapping 物件的建構函式。

參數
testMappingRelativePaths :TEST_MAPPING 檔案路徑的 ERROR(/List)

ignoreTestMappingImports boolean:要忽略匯入作業的 ERROR(/boolean)

公用方法

extractTestMappingsZip

public static File extractTestMappingsZip (File testMappingsZip)

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

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

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

getAllTests

public  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 (IBuildInfo buildInfo, 
                String testGroup, 
                boolean hostOnly, 
                 keywords, 
                 ignoreKeywords)

輔助程式可根據裝置版本中的構件,在所有 TEST_MAPPING 檔案中尋找所有測試。

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

testGroup String:測試組的 String

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

keywords :在篩選要執行的測試時,用於比對的 String 集。

ignoreKeywords :要忽略的 String 關鍵字組合。

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

getTests

public  getTests (IBuildInfo buildInfo, 
                String testGroup, 
                boolean hostOnly, 
                 keywords, 
                 ignoreKeywords, 
                 extraZipNames, 
                 matchedPatternPaths)

根據指定的構件,在所有 TEST_MAPPING 檔案中尋找所有測試的輔助程式。如果套件執行作業需要針對特定群組 (例如預先提交) 的 TEST_MAPPING 檔案中所有測試執行所有測試,就需要這個屬性。

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

testGroup String:測試組的 String

hostOnly boolean:如果只在主機上執行測試,且不需使用裝置,則為 true。如果傳回 false,則會傳回需要裝置執行的測試。

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

ignoreKeywords :一組要忽略的 String 關鍵字。

extraZipNames :一組 String,代表要合併的其他 test_mappings.zip 名稱。

matchedPatternPaths :檔案路徑符合模式的 ERROR(/Set)

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

listTestMappingFiles

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

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

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

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

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