• [Gts]Fail-GtsTvTestCases#testLauncherChange


    【问题描述】

    Gts-7.0-R4新增测试项、失败项。
    -m GtsTvTestCases -t com.google.android.tv.gts.LauncherChangeTest#testLauncherChange
    02-29 13:03:11 I/ModuleListener: [1/1] com.google.android.tv.gts com.google.android.tv.gts.LauncherChangeTest#testLauncherChange fail:
    java.lang.AssertionError: Android TV launcher doesn't resolve first, resolve stack:
    ResolveInfo.ActivityInfo.packageName: com.eeee.dddd priority: 0
    ResolveInfo.ActivityInfo.packageName: com.google.android.pseudolauncheractivity priority: 0
    ResolveInfo.ActivityInfo.packageName: com.android.tv.settings priority: -1000
    at org.junit.Assert.fail(Assert.java:88)
    at com.google.android.tv.gts.LauncherChangeTest.testLauncherChange(LauncherChangeTest.java:89)

    【问题结论】

    最新结论,chip-mk认同是Google的问题,已申请Google waiver。

    AuthBlog:秋城https://www.cnblogs.com/houser0323

    猜测Google测试用例的问题,需要同芯片厂商沟通确认。

    【分析详细】###

    1.反编译GtsTvTestCases.apk分析测试用例的逻辑,梳理如下:

    @Test
        public void testLauncherChange() throws Exception {
            String str = TAG;
            Log.i(str, "testLauncherChange()");
            PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
            Intent intent = new Intent("android.intent.action.MAIN");
            intent.addCategory("android.intent.category.HOME");
            List<ResolveInfo> resolveInfos = pm.queryIntentActivities(intent, 0);//1.获取所有,上述intent(过滤能力)的package
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("testLauncherChange() : resolveInfos.size(): ");
            stringBuilder.append(resolveInfos.size());
            stringBuilder.append("
    
    
    ");
            Log.i(str, stringBuilder.toString());
            Assert.assertFalse("No launcher present", resolveInfos.isEmpty());
            stringBuilder = new StringBuilder();
            for (ResolveInfo r : resolveInfos) {
                String debug = new StringBuilder();
                debug.append("ResolveInfo.ActivityInfo.packageName: ");
                debug.append(r.activityInfo.packageName);
                debug.append("	 priority: ");
                debug.append(r.priority);
                debug = debug.toString();
                StringBuilder stringBuilder2 = new StringBuilder();
                stringBuilder2.append("
    	");
                stringBuilder2.append(debug);
                stringBuilder.append(stringBuilder2.toString());
                Log.d(str, debug);
            }
            String packageName = ((ResolveInfo) resolveInfos.get(0)).activityInfo.packageName;
            int priority = ((ResolveInfo) resolveInfos.get(0)).priority;
            StringBuilder stringBuilder3 = new StringBuilder();
            stringBuilder3.append("packageName: >");
            stringBuilder3.append(packageName);
            stringBuilder3.append("<");
            Log.i(str, stringBuilder3.toString());
    		//根据堆栈打印我们发现,EE的Launcher不满足最后一处priority=2,这个需要修改。
    		//但是用例的第二处要求包名是"com.google.android.",这不合理。怀疑测试用例有问题。
            if (packageName.equals("com.google.android.pseudolauncheractivity") || !packageName.startsWith("com.google.android.") || priority != 2) {
                StringBuilder stringBuilder4 = new StringBuilder();
                stringBuilder4.append("Android TV launcher doesn't resolve first, resolve stack:");
                stringBuilder4.append(stringBuilder);
                Assert.fail(stringBuilder4.toString());//堆栈显示在此处89行断言
            }
        }
    }
    
  • 相关阅读:
    Python--day61--Django ORM单表操作之展示用户列表
    Python--day61 PyCharm连接MySQL工具的使用
    Python--day61--ORM介绍及Django使用ORM创建表
    Python--day49--ORM框架SQLAlchemy之relationship的使用(有时间要从新看,这里状态不好,没有仔细听)
    Python--day48--ORM框架SQLAlchemy之子查询
    Python--day48--ORM框架SQLAlchemy操作表
    Python--day48--ORM框架SQLAlchemy
    Python--day48--面向对象回顾
    web api 限制单个IP在一定时间内访问次数
    前端常用js插件
  • 原文地址:https://www.cnblogs.com/houser0323/p/12430598.html
Copyright © 2020-2023  润新知