IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 移动开发 -> 使用am instrument测试CTS -> 正文阅读

[移动开发]使用am instrument测试CTS

前言】CTS 测试某个testcase常用的测试方法:CTS tool or atest都可以满足,选哪个使用要结合当前开发测试环境,这里简单介绍另一种方法:instrumentation,详细介绍参考:https://source.android.google.cn/compatibility/tests/development/instrumentation

使用

  1. adb install “cts apk“,比如CtsMediaV2TestCases apk
  2. adb?shell pm list instrumentation,列出来的结果填在下面-w的后面
    instrumentation:android.mediav2.cts/androidx.test.runner.AndroidJUnitRunner (target=android.mediav2.cts)
  3. adb shell am instrument? -r -e class "class_name#method_name" -w "instrumentation",instrumentation在测试apk的AndroidManifest.xml里有声明。
    adb shell am instrument? -e class "class_name#method_name" -r -w "instrumentation"? =>测试某个case
    adb shell am instrument? -e class "class_name" -r -w "instrumentation"? =>测试某个class
    adb shell am instrument? -w "instrumentation"? =>测试整个module
    
    如下测试:
    adb shell am instrument -r -e class android.mediav2.cts.CodecDecoderPauseTest -w android.mediav2.cts/androidx.test.runner.AndroidJUnitRunner
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=1
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=
    android.mediav2.cts.CodecDecoderPauseTest:
    INSTRUMENTATION_STATUS: test=testPause[0(c2.android.aac.decoder_audio/mp4a-latm)]
    INSTRUMENTATION_STATUS_CODE: 1
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=1
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=.
    INSTRUMENTATION_STATUS: test=testPause[0(c2.android.aac.decoder_audio/mp4a-latm)]
    INSTRUMENTATION_STATUS_CODE: 0
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=2
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=
    INSTRUMENTATION_STATUS: test=testPause[1(OMX.realtek.video.decoder_video/3gpp)]
    INSTRUMENTATION_STATUS_CODE: 1
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=2
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=.
    INSTRUMENTATION_STATUS: test=testPause[1(OMX.realtek.video.decoder_video/3gpp)]
    INSTRUMENTATION_STATUS_CODE: 0
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=3
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=
    INSTRUMENTATION_STATUS: test=testPause[2(c2.android.h263.decoder_video/3gpp)]
    INSTRUMENTATION_STATUS_CODE: 1
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=3
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=.
    INSTRUMENTATION_STATUS: test=testPause[2(c2.android.h263.decoder_video/3gpp)]
    INSTRUMENTATION_STATUS_CODE: 0
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=4
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=
    INSTRUMENTATION_STATUS: test=testPause[3(OMX.realtek.video.decoder_video/avc)]
    INSTRUMENTATION_STATUS_CODE: 1
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=4
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=.
    INSTRUMENTATION_STATUS: test=testPause[3(OMX.realtek.video.decoder_video/avc)]
    INSTRUMENTATION_STATUS_CODE: 0
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=5
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=
    INSTRUMENTATION_STATUS: test=testPause[4(c2.android.avc.decoder_video/avc)]
    INSTRUMENTATION_STATUS_CODE: 1
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=5
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=.
    INSTRUMENTATION_STATUS: test=testPause[4(c2.android.avc.decoder_video/avc)]
    INSTRUMENTATION_STATUS_CODE: 0
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=6
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=
    INSTRUMENTATION_STATUS: test=testPause[5(OMX.realtek.video.decoder_video/hevc)]
    INSTRUMENTATION_STATUS_CODE: 1
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=6
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=.
    INSTRUMENTATION_STATUS: test=testPause[5(OMX.realtek.video.decoder_video/hevc)]
    INSTRUMENTATION_STATUS_CODE: 0
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=7
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=
    INSTRUMENTATION_STATUS: test=testPause[6(c2.android.hevc.decoder_video/hevc)]
    INSTRUMENTATION_STATUS_CODE: 1
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=7
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=.
    INSTRUMENTATION_STATUS: test=testPause[6(c2.android.hevc.decoder_video/hevc)]
    INSTRUMENTATION_STATUS_CODE: 0
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=8
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=
    INSTRUMENTATION_STATUS: test=testPause[7(OMX.realtek.video.decoder_video/mp4v-es)]
    INSTRUMENTATION_STATUS_CODE: 1
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=8
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=.
    INSTRUMENTATION_STATUS: test=testPause[7(OMX.realtek.video.decoder_video/mp4v-es)]
    INSTRUMENTATION_STATUS_CODE: 0
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=9
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=
    INSTRUMENTATION_STATUS: test=testPause[8(c2.android.mpeg4.decoder_video/mp4v-es)]
    INSTRUMENTATION_STATUS_CODE: 1
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=9
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=.
    INSTRUMENTATION_STATUS: test=testPause[8(c2.android.mpeg4.decoder_video/mp4v-es)]
    INSTRUMENTATION_STATUS_CODE: 0
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=10
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=
    INSTRUMENTATION_STATUS: test=testPause[9(OMX.realtek.video.decoder_video/mpeg2)]
    INSTRUMENTATION_STATUS_CODE: 1
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=10
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=.
    INSTRUMENTATION_STATUS: test=testPause[9(OMX.realtek.video.decoder_video/mpeg2)]
    INSTRUMENTATION_STATUS_CODE: 0
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=11
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=
    INSTRUMENTATION_STATUS: test=testPause[10(c2.android.mpeg2.decoder_video/mpeg2)]
    INSTRUMENTATION_STATUS_CODE: 1
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=11
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=.
    INSTRUMENTATION_STATUS: test=testPause[10(c2.android.mpeg2.decoder_video/mpeg2)]
    INSTRUMENTATION_STATUS_CODE: 0
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=12
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=
    INSTRUMENTATION_STATUS: test=testPause[11(OMX.realtek.video.decoder_video/x-vnd.on2.vp9)]
    INSTRUMENTATION_STATUS_CODE: 1
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=12
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=.
    INSTRUMENTATION_STATUS: test=testPause[11(OMX.realtek.video.decoder_video/x-vnd.on2.vp9)]
    INSTRUMENTATION_STATUS_CODE: 0
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=13
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=
    INSTRUMENTATION_STATUS: test=testPause[12(c2.android.vp9.decoder_video/x-vnd.on2.vp9)]
    INSTRUMENTATION_STATUS_CODE: 1
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=13
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=.
    INSTRUMENTATION_STATUS: test=testPause[12(c2.android.vp9.decoder_video/x-vnd.on2.vp9)]
    INSTRUMENTATION_STATUS_CODE: 0
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=14
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=
    INSTRUMENTATION_STATUS: test=testPause[13(c2.android.vp8.decoder_video/x-vnd.on2.vp8)]
    INSTRUMENTATION_STATUS_CODE: 1
    INSTRUMENTATION_STATUS: class=android.mediav2.cts.CodecDecoderPauseTest
    INSTRUMENTATION_STATUS: current=14
    INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
    INSTRUMENTATION_STATUS: numtests=14
    INSTRUMENTATION_STATUS: stream=.
    INSTRUMENTATION_STATUS: test=testPause[13(c2.android.vp8.decoder_video/x-vnd.on2.vp8)]
    INSTRUMENTATION_STATUS_CODE: 0
    INSTRUMENTATION_RESULT: stream=
    
    Time: 153.618
    
    OK (14 tests)
    
    
    INSTRUMENTATION_CODE: -1

other

? am instrument参数:

命令格式:
 
 instrument [-r] [-e ] [-p ] [-w]         [--user | current]         [--no-window-animation] [--abi ]      
Start an Instrumentation.  Typically this target is in the     form / or only if there     is only one instrumentation. 
 
Options are:     
 
-r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT).  Use with  [-e perf true] to generate raw output for performance measurements.     
 
-e : set argument to .  For test runners a         common form is [-e [,...]].     
 
-p : write profiling data to      
 
-m: Write output as protobuf (machine readable)     
 
-w: wait for instrumentation to finish before returning.  Required for  test runners.   
 
 --user | current: Specify user instrumentation runs in;  current user if not specified.     
 
--no-window-animation: turn off window animations while running.     
 
--abi : Launch the instrumented process with the selected ABI. This assumes that the process supports the selected ABI
 
各项参数:
 
-r:以原始形式输出测试结果;该选项通常是在性能测试时与[-e perf true]一起使用。
 
-e name value:提供了以键值对形式存在的过滤器和参数。例如:-e testFile (运行文件中指定的用例);-e package (运行这个包中的所有用例)……  有十几种。 
 
-p file:将分析数据写入file。
 
-w:测试运行器需要使用此选项。-w / :和在测试工程的AndroidManifest.xml中查找,作用是保持adb shell打开直至测试完成。
 
--no-window-animation:运行时关闭窗口动画。
 
--useruser_id | current:指定仪器在哪个用户中运行;如果未指定,则在当前用户中运行。

参考:

1、https://www.freesion.com/article/6158235376/

2、使用Instrumentation命令测试cts apk - 简书

  移动开发 最新文章
Vue3装载axios和element-ui
android adb cmd
【xcode】Xcode常用快捷键与技巧
Android开发中的线程池使用
Java 和 Android 的 Base64
Android 测试文字编码格式
微信小程序支付
安卓权限记录
知乎之自动养号
【Android Jetpack】DataStore
上一篇文章      下一篇文章      查看所有文章
加:2022-04-04 12:22:54  更:2022-04-04 12:24:22 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/24 21:02:11-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码