命令行运行uiautomator
来源:互联网 发布:类似于企查查的软件 编辑:程序博客网 时间:2024/05/18 01:07
sdk/docs/reference/android/support/test/runner/AndroidJUnitRunner.html
Typical Usage
Write JUnit3 style TestCase
s and/or JUnit4 style Test
s that perform tests against the classes in your package. Make use of theInstrumentationRegistry
if needed.
In an appropriate AndroidManifest.xml, define an instrumentation with android:name set toAndroidJUnitRunner
and the appropriate android:targetPackage set.
Execution options:
Running all tests: adb shell am instrument -w com.android.foo/android.support.test.runner.AndroidJUnitRunner
Running all tests in a class: adb shell am instrument -w -e class com.android.foo.FooTest com.android.foo/android.support.test.runner.AndroidJUnitRunner
Running a single test: adb shell am instrument -w -e class com.android.foo.FooTest#testFoo com.android.foo/android.support.test.runner.AndroidJUnitRunner
Running all tests in multiple classes: adb shell am instrument -w -e class com.android.foo.FooTest,com.android.foo.TooTest com.android.foo/android.support.test.runner.AndroidJUnitRunner
Running all tests listed in a file: adb shell am instrument -w -e testFile /sdcard/tmp/testFile.txt com.android.foo/com.android.test.runner.AndroidJUnitRunner The file should contain a list of line separated test classes and optionally methods (expected format: com.android.foo.FooClassName#testMethodName).
Running all tests in a java package: adb shell am instrument -w -e package com.android.foo.bar com.android.foo/android.support.test.runner.AndroidJUnitRunnerTo debug your tests, set a break point in your code and pass: -e debug true
Running a specific test size i.e. annotated with SmallTest
orMediumTest
or LargeTest
: adb shell am instrument -w -e size [small|medium|large] com.android.foo/android.support.test.runner.AndroidJUnitRunner
Filter test run to tests with given annotation: adb shell am instrument -w -e annotation com.android.foo.MyAnnotation com.android.foo/android.support.test.runner.AndroidJUnitRunner
If used with other options, the resulting test run will contain the intersection of the two options. e.g. "-e size large -e annotation com.android.foo.MyAnnotation" will run only tests with both theLargeTest
and "com.android.foo.MyAnnotation" annotations.
Filter test run to tests without given annotation: adb shell am instrument -w -e notAnnotation com.android.foo.MyAnnotation com.android.foo/android.support.test.runner.AndroidJUnitRunner
As above, if used with other options, the resulting test run will contain the intersection of the two options. e.g. "-e size large -e notAnnotation com.android.foo.MyAnnotation" will run tests with theLargeTest
annotation that do NOT have the "com.android.foo.MyAnnotation" annotations.
Filter test run to tests without any of a list of annotations: adb shell am instrument -w -e notAnnotation com.android.foo.MyAnnotation,com.android.foo.AnotherAnnotation com.android.foo/android.support.test.runner.AndroidJUnitRunner
Filter test run to a shard of all tests, where numShards is an integer greater than 0 and shardIndex is an integer between 0 (inclusive) and numShards (exclusive): adb shell am instrument -w -e numShards 4 -e shardIndex 1 com.android.foo/android.support.test.runner.AndroidJUnitRunner
To run in 'log only' mode -e log true This option will load and iterate through all test classes and methods, but will bypass actual test execution. Useful for quickly obtaining info on the tests to be executed by an instrumentation command.
To generate EMMA code coverage: -e coverage true Note: this requires an emma instrumented build. By default, the code coverage results file will be saved in a /data//coverage.ec file, unless overridden by coverageFile flag (see below)
To specify EMMA code coverage results file path: -e coverageFile /sdcard/myFile.ec
To specify one or more RunListener
s to observe the test run: -e listener com.foo.Listener,com.foo.Listener2
Set timeout (in milliseconds) that will be applied to each test: -e timeout_msec 5000
Supported for both JUnit3 and JUnit4 style tests. For JUnit3 tests, this flag is the only way to specify timeouts. For JUnit4 tests, this flag overrides timeouts specified viaorg.junit.rules.Timeout
. Please note that in JUnit4 org.junit.Test#timeout()
annotation take precedence over both, this flag andorg.junit.Test#timeout()
annotation.
To disable Google Analytics: -e disableAnalytics true
In order to make sure we are on the right track with each new release, the test runner collects analytics. More specifically, it uploads a hash of the package name of the application under test for each invocation. This allows us to measure both the count of unique packages using this library as well as the volume of usage.
All arguments can also be specified in the in the AndroidManifest via a meta-data tag: eg. using listeners: instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" ... meta-data android:name="listener" android:value="com.foo.Listener,com.foo.Listener2" Arguments specified via shell will take override manifest specified arguments.
- 命令行运行uiautomator
- java+uiautomator 打包运行
- uiautomator如何编译运行
- Uiautomator编译运行的自动化
- UiAutomator运行命令时传多个参数
- Android Studio下运行UiAutomator
- uiautomator一个简单脚本运行
- UIAutomator源码分析之启动和运行
- UIAutomator源码分析之启动和运行
- UIAutomator源码分析之启动和运行
- UIAutomator源码分析之启动和运行
- UiAutoMator Helper自动运行测试用例
- Android UiAutomator编译与运行测试代码
- Android-Uiautomator:[6]运行中传入参数
- Android UiAutomator: 断开USB运行脚本
- Android UiAutomator环境配置与编译运行
- Android UiAutomator环境配置与编译运行
- UiAutomator配置环境与编译运行
- jQuery Ajax异步处理Json数据详解
- <input>和<button>设置同样高度却不能等高
- Java加密技术
- 360WIFI2无线网卡移植 -MT7601U移植
- 关于驱动模块分离概念
- 命令行运行uiautomator
- 2016 ACM/ICPC Asia Regional Dalian Online Football Games
- 首页和登录页分离
- 5.vc从零开始 -- Win32项目hello world(三)
- PAT 1069. The Black Hole of Numbers (20)(数字黑洞)
- HDU1233-还是畅通工程(Prim算法+Kruskal算法)
- 什么是三层架构?简单的介绍三层架构!
- uva11440 Help Tomisu
- Android Debug Bridge