android cts test package 管理有点混乱
比如 testpackage android.appwidget 的文件是 CtsAppWidgetTestCases.xml (大概只有有1/4的文件名和testpackage名字一致, 3/4不一致 )
当你生成test plan 的plan 又要指明 testpackage
<?xml version='1.0' encoding='UTF-8'?>
<TestPlan version="1.0">
<Entry name="android.appwidget" />
我写了段python脚本,找出这些不一致的
先运行 find *.xml > xml_files 导出所有 testpackage xml文件名
而后运行下面的 python 脚本
import sys
import re
import os, os.path, glob
import shutil
import csv
from xml.etree.ElementTree import ElementTree
from xml.etree.ElementTree import Element
from xml.etree.ElementTree import SubElement
from xml.etree.ElementTree import dump
from xml.etree.ElementTree import Comment
from xml.etree.ElementTree import tostring
def findEntryElement(packageRoot):
if "appPackageName" in packageRoot.attrib:
appPackageName = packageRoot.attrib['appPackageName']
return appPackageName
else:
return None
fh = open('xml_files')
for fileName in fh.readlines():
fileName = fileName.strip()
packageET = ElementTree()
try:
packageRoot = packageET.parse(fileName)
except IOError:
print "\nWARNING: Cannot read " + testFileName
packageName = findEntryElement(packageRoot)
if packageName + ".xml" == fileName:
continue #print fileName + " is package name"
else:
print "'"+packageName + "':'" + fileName + "',"得到结果
'android.bionic':'bionic-unit-tests-cts.xml',
'android.acceleration':'CtsAccelerationTestCases.xml',
'android.accessibilityservice':'CtsAccessibilityServiceTestCases.xml',
'android.accessibility':'CtsAccessibilityTestCases.xml',
'android.accounts':'CtsAccountManagerTestCases.xml',
'android.aadb':'CtsAdbTests.xml',
'android.admin':'CtsAdminTestCases.xml',
'android.animation':'CtsAnimationTestCases.xml',
'android.tests.appsecurity':'CtsAppSecurityTests.xml',
'android.app':'CtsAppTestCases.xml',
'android.appwidget':'CtsAppWidgetTestCases.xml',
'android.bluetooth':'CtsBluetoothTestCases.xml',
'android.calendarcommon':'CtsCalendarcommon2TestCases.xml',
'android.content':'CtsContentTestCases.xml',
'android.database':'CtsDatabaseTestCases.xml',
'com.android.cts.browserbench':'CtsDeviceBrowserBench.xml',
'com.android.cts.dram':'CtsDeviceDram.xml',
'com.android.cts.filesystemperf':'CtsDeviceFilePerf.xml',
'com.android.cts.opengl':'CtsDeviceOpenGl.xml',
'android.adminhostside':'CtsDevicePolicyManagerTestCases.xml',
'com.android.cts.simplecpu':'CtsDeviceSimpleCpu.xml',
'com.android.cts.tvproviderperf':'CtsDeviceTvProviderPerf.xml',
'com.android.cts.ui':'CtsDeviceUi.xml',
'com.android.cts.videoperf':'CtsDeviceVideoPerf.xml',
'android.display':'CtsDisplayTestCases.xml',
'android.dpi2':'CtsDpiTestCases2.xml',
'android.dpi':'CtsDpiTestCases.xml',
'android.dreams':'CtsDreamsTestCases.xml',
'android.drm':'CtsDrmTestCases.xml',
'android.host.dumpsys':'CtsDumpsysHostTestCases.xml',
'android.effect':'CtsEffectTestCases.xml',
'android.gesture':'CtsGestureTestCases.xml',
'android.graphics2':'CtsGraphics2TestCases.xml',
'android.graphics':'CtsGraphicsTestCases.xml',
'android.hardware':'CtsHardwareTestCases.xml',
'com.android.cts.jank':'CtsHostJank.xml',
'android.net.hostsidenetwork':'CtsHostsideNetworkTests.xml',
'com.android.cts.uihost':'CtsHostUi.xml',
'android.host.jdwpsecurity':'CtsJdwpSecurityHostTestCases.xml',
'android.jdwp':'CtsJdwp.xml',
'android.jni':'CtsJniTestCases.xml',
'android.JobScheduler':'CtsJobSchedulerDeviceTestCases.xml',
'android.keystore':'CtsKeystoreTestCases.xml',
'android.location2':'CtsLocation2TestCases.xml',
'android.location':'CtsLocationTestCases.xml',
'android.mediastress':'CtsMediaStressTestCases.xml',
'android.media':'CtsMediaTestCases.xml',
'zzz.android.monkey':'CtsMonkeyTestCases.xml',
'android.nativeopengl':'CtsNativeOpenGLTestCases.xml',
'android.ndef':'CtsNdefTestCases.xml',
'android.net':'CtsNetTestCases.xml',
'android.openglperf':'CtsOpenGlPerfTestCases.xml',
'android.opengl':'CtsOpenGLTestCases.xml',
'android.os':'CtsOsTestCases.xml',
'android.permission2':'CtsPermission2TestCases.xml',
'android.permission':'CtsPermissionTestCases.xml',
'android.preference2':'CtsPreference2TestCases.xml',
'android.preference':'CtsPreferenceTestCases.xml',
'android.print':'CtsPrintTestCases.xml',
'android.provider':'CtsProviderTestCases.xml',
'android.renderscriptlegacy':'CtsRenderscriptLegacyTestCases.xml',
'android.renderscript':'CtsRenderscriptTestCases.xml',
'android.rscpp':'CtsRsCppTestCases.xml',
'android.sax':'CtsSaxTestCases.xml',
'android.host.security':'CtsSecurityHostTestCases.xml',
'android.security':'CtsSecurityTestCases.xml',
'android.signature':'CtsSignatureTestCases.xml',
'android.speech':'CtsSpeechTestCases.xml',
'android.telephony':'CtsTelephonyTestCases.xml',
'android.text':'CtsTextTestCases.xml',
'android.textureview':'CtsTextureViewTestCases.xml',
'android.host.theme':'CtsThemeHostTestCases.xml',
'android.theme':'CtsThemeTestCases.xml',
'android.tv':'CtsTvTestCases.xml',
'android.uiautomation':'CtsUiAutomationTestCases.xml',
'android.uiautomator':'CtsUiAutomatorTests.xml',
'android.uirendering':'CtsUiRenderingTestCases.xml',
'android.app.usage':'CtsUsageStatsTestCases.xml',
'android.usb':'CtsUsbTests.xml',
'android.util':'CtsUtilTestCases.xml',
'android.view':'CtsViewTestCases.xml',
'android.webgl':'CtsWebGLTestCases.xml',
'android.webkit':'CtsWebkitTestCases.xml',
'android.widget':'CtsWidgetTestCases.xml',
'android.nativemedia.sl':'NativeMediaTest_SL.xml',
'android.nativemedia.xa':'NativeMediaTest_XA.xml',
Android CTS的testpackage管理和文件名对应关系不清晰,例如testpackage为android.appwidget的测试用例文件是CtsAppWidgetTestCases.xml。大部分情况下文件名与testpackage不匹配。生成测试计划时需要指定testpackage。提供了一个Python脚本来查找并解决这种不一致的问题。
1888

被折叠的 条评论
为什么被折叠?



