TestMapping

public class TestMapping
extends Object

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


用於載入 TEST_MAPPING 檔案的類別。

摘要

巢狀類別

class TestMapping.NoTestRuntimeException

 

常數

String TEST_MAPPINGS_ZIP

String TEST_SOURCES

欄位

public static final Pattern MAINLINE_REGEX

公用建構函式

TestMapping()

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

TestMapping( testMappingRelativePaths, boolean ignoreTestMappingImports)

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

公用方法

static File extractTestMappingsZip(File testMappingsZip)

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

getAllTests(File testMappingsDir)

Helper 可從指定目錄的 TEST_MAPPING 檔案中找出所有測試。

static Matcher getMainlineTestModuleName(TestInfo info)

Helper 可取得參數化主線測試的相符項目。

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

Helper to find all tests in all TEST_MAPPING files based on an artifact in the device build.

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

Helper to find all tests in all TEST_MAPPING files based on the given artifact.

void listTestMappingFiles(Path testMappingDir, Path testMappingsRootDir, filePaths)

這個輔助程式會列出所有測試對應檔案,尋找所有上層目錄和相關匯入路徑。

常數

TEST_MAPPINGS_ZIP

public static final String TEST_MAPPINGS_ZIP

常數值: "test_mappings.zip"

TEST_SOURCES

public static final String TEST_SOURCES

常數值: "Test Sources"

欄位

MAINLINE_REGEX

public static final Pattern MAINLINE_REGEX

公用建構函式

TestMapping

public TestMapping ()

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

TestMapping

public TestMapping ( testMappingRelativePaths, 
                boolean ignoreTestMappingImports)

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

參數
testMappingRelativePaths ERROR(/List) 至 TEST_MAPPING 檔案路徑。

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

公用方法

extractTestMappingsZip

public static File extractTestMappingsZip (File testMappingsZip)

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

參數
testMappingsZip File:要解壓縮的測試對應 ZIP 檔。ERROR(/File)

傳回
File 指向測試對應 ZIP 檔暫時目錄的 ERROR(/File)

getAllTests

public  getAllTests (File testMappingsDir)

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

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

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

getMainlineTestModuleName

public static Matcher getMainlineTestModuleName (TestInfo info)

Helper,可取得參數化主線測試的相符項目。

參數
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 PathERROR(/Path) 至 TEST_MAPPING 檔案上層目錄。

testMappingsRootDir Path:建構版本的所有 TEST_MAPPING 檔案資料夾。ERROR(/Path)

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