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(List<String> testMappingRelativePaths, boolean ignoreTestMappingImports)

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

公用方法

static File extractTestMappingsZip(File testMappingsZip)

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

Map<String, Set<TestInfo>> getAllTests(File testMappingsDir)

Helper to find all tests in the TEST_MAPPING files from a given directory.

static Matcher getMainlineTestModuleName(TestInfo info)

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

Set<TestInfo> getTests(IBuildInfo buildInfo, String testGroup, boolean hostOnly, Set<String> keywords, Set<String> ignoreKeywords, boolean exactKeywordMatch, List<String> extraZipNames, Set<String> matchedPatternPaths)

Helper,可根據指定構件,在所有 TEST_MAPPING 檔案中尋找所有測試。

Set<TestInfo> getTests(IBuildInfo buildInfo, String testGroup, boolean hostOnly, Set<String> keywords, Set<String> ignoreKeywords, boolean exactKeywordMatch)

這個輔助程式會根據裝置建構中的構件,找出所有 TEST_MAPPING 檔案中的所有測試。

void listTestMappingFiles(Path testMappingDir, Path testMappingsRootDir, Set<Path> 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 (List<String> testMappingRelativePaths, 
                boolean ignoreTestMappingImports)

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

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

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

公用方法

extractTestMappingsZip

public static File extractTestMappingsZip (File testMappingsZip)

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

參數
testMappingsZip File:要解壓縮的測試對應 zip 檔 File

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

getAllTests

public Map<String, Set<TestInfo>> getAllTests (File testMappingsDir)

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

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

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

getMainlineTestModuleName

public static Matcher getMainlineTestModuleName (TestInfo info)

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

參數
info TestInfo

傳回
Matcher 參數化主線測試的 Matcher

擲回
ConfigurationException

getTests

public Set<TestInfo> getTests (IBuildInfo buildInfo, 
                String testGroup, 
                boolean hostOnly, 
                Set<String> keywords, 
                Set<String> ignoreKeywords, 
                boolean exactKeywordMatch, 
                List<String> extraZipNames, 
                Set<String> matchedPatternPaths)

這個輔助程式可根據指定構件,在所有 TEST_MAPPING 檔案中找出所有測試。如果套件執行作業需要執行特定群組中 TEST_MAPPING 檔案的所有測試 (例如預先提交),就必須使用這項功能。

參數
buildInfo IBuildInfo:說明建構作業的 IBuildInfo

testGroup String:測試組的 String

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

keywords Set:一組 String,用於篩選要在測試對應套件中執行的測試。

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

exactKeywordMatch boolean

extraZipNames List:一組 String,用於要合併的其他 test_mappings.zip 名稱。

matchedPatternPaths Set:與模式相符的檔案路徑。ERROR(/Set)

傳回
Set<TestInfo> 建構構件中設定的一組測試,即 test_mappings.zip。Set<TestInfo>

getTests

public Set<TestInfo> getTests (IBuildInfo buildInfo, 
                String testGroup, 
                boolean hostOnly, 
                Set<String> keywords, 
                Set<String> ignoreKeywords, 
                boolean exactKeywordMatch)

這個輔助程式可根據裝置建構中的構件,找出所有 TEST_MAPPING 檔案中的所有測試。

參數
buildInfo IBuildInfo:說明建構作業的 IBuildInfo

testGroup String:測試組的 String

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

keywords Set:一組 String,用於篩選要在測試對應套件中執行的測試。

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

exactKeywordMatch boolean

傳回
Set<TestInfo> 建構構件中設定的一組測試,即 test_mappings.zip。Set<TestInfo>

listTestMappingFiles

public void listTestMappingFiles (Path testMappingDir, 
                Path testMappingsRootDir, 
                Set<Path> filePaths)

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

參數
testMappingDir PathPath 至 TEST_MAPPING 檔案上層目錄的路徑。

testMappingsRootDir Path:建構版本的所有 TEST_MAPPING 檔案資料夾路徑。Path

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