常用命令整理

1. 搜索包含特定内容的文件

find ./ -name "*.py" -exec grep -inH "test" {} \;

-i 忽略大小写

-n 显示行号

-H 显示文件名


2. 安装Python包

当遇到cannot find vcvarsall.bat的错误时

python setup.py build --compiler=mingw32

python setup.py install --record install.log --skip-build

3. 卸载python包

cat install.log | xagrs rm -rf


4. 命令行运行instrumentation测试

4.1 列出所有可运行的instrumentation用例

adb shell pm list instrumentation

4.2 对整个测试包进行测试

adb shell am instrument -w com.test.package/android.test.InstrumentationTestRunner

4.3 对单个suite进行测试

adb shell am instrument -e class com.test.package.SuiteA -w com.test.package/android.test.InstrumentationTestRunner

4.4 对单个case进行测试

adb shell am instrument -e class com.test.package.SuiteA#CaseA -w com.test.package/android.test.InstrumentationTestRunner


5. 使用Android ant管理仅有测试用apk文件的测试项目

注意:需要把robotium加入到项目下的libs目录下,否则使用ant编译后找不到robotium的类库

生成build.xm: android update project -p ./

查看ant可用选项:ant

help:
     [echo] Android Ant Build. Available targets:
     [echo]    help:      Displays this help.
     [echo]    clean:     Removes output files created by other targets.
     [echo]               The 'all' target can be used to clean dependencies
     [echo]               (tested projects and libraries)at the same time
     [echo]               using: 'ant all clean'
     [echo]    debug:     Builds the application and signs it with a debug key.
     [echo]               The 'nodeps' target can be used to only build the
     [echo]               current project and ignore the libraries using:
     [echo]               'ant nodeps debug'
     [echo]    release:   Builds the application. The generated apk file must be
     [echo]               signed before it is published.
     [echo]               The 'nodeps' target can be used to only build the
     [echo]               current project and ignore the libraries using:
     [echo]               'ant nodeps release'
     [echo]    instrument:Builds an instrumented package and signs it with a
     [echo]               debug key.
     [echo]    test:      Runs the tests. Project must be a test project and
     [echo]               must have been built. Typical usage would be:
     [echo]                   ant [emma] debug install test
     [echo]    emma:      Transiently enables code coverage for subsequent
     [echo]               targets.
     [echo]    install:   Installs the newly build package. Must either be used
     [echo]               in conjunction with a build target (debug/release/
     [echo]               instrument) or with the proper suffix indicating
     [echo]               which package to install (see below).
     [echo]               If the application was previously installed, the
     [echo]               application is reinstalled if the signature matches.
     [echo]    installd:  Installs (only) the debug package.
     [echo]    installr:  Installs (only) the release package.
     [echo]    installi:  Installs (only) the instrumented package.
     [echo]    installt:  Installs (only) the test and tested packages (unless
     [echo]               nodeps is used as well.
     [echo]    uninstall: Uninstalls the application from a running emulator or
     [echo]               device. Also uninstall tested package if applicable
     [echo]               unless 'nodeps' is used as well.


编译: ant debug

安装: ant installd

运行: 参考4. 命令行运行instrumentation测试


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值