资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

androidcts相关

1 在linux和windows中使用不同的命令打开窗口,比如使用adb 时,linux要用:

成都网站建设、做网站,成都做网站公司-成都创新互联已向上1000家企业提供了,网站设计,网站制作,网络营销等服务!设计与技术结合,多年网站推广经验,合理的价格为您打造企业品质网站。

Runtime.getRuntime().exec(new String[] {"/bin/sh","-c",cmd});

而windows会用 

Runtime.getRuntime().exec(new String[] {"cmd","/c",cmd});,

如果都用/bin/bash,会报以下错误:

java.io.IOException: Cannot run program "/bin/bash": CreateProcess error=2, The system cannot find the file specified

    at java.lang.ProcessBuilder.start(Unknown Source)

    at java.lang.Runtime.exec(Unknown Source)

    at java.lang.Runtime.exec(Unknown Source)

2 set aapt before running CTS

CTS currently supports 64-bit Linux and Mac OShost machines.

Before running the CTS, make sure you have recent versions of both Android Debug Bridge (adb) and Android Asset Packaging Tool (AAPT) installed and those tools' location added to the system path of your machine.

To install ADB, download the Android SDK Tools package for your operating system, open it, and follow the instructions in the included README file. For troubleshooting information, see Installing the Stand-alone SDK Tools.

Ensure adb and aapt are in your system path. The following command assumes you've opened the package archive in your home directory:

export PATH=$PATH:$HOME/android-sdk-linux/build-tools/

3 UI automator

使用UI.takeScreenshot(path), path related

a) 使用

/data/local/tmp/

时生成文件aa.png报错,只能先push 一个叫aa.png的文件之后,才能截屏时,替换原来的文件

b)

使用当前testcase本身的包路径,可以生成文件,但是不能pull出来 Permission denied

文件实际路径:/data/user/0/com.test/files/aa.png

c) 

save files that are private to your app

File f=  mContext.getApplicationContext().getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
File path = new File(f.getAbsolutePath()+File.separator+"99.png");
mDevice.takeScreenshot(path);

可以直接生成文件aa.png.

文件实际路径:

/storage/emulated/0/Android/data/com.test/files/Download/aa.png

d)

save public files on the external stroage

File f=  Environment.(Environment.)File path = File(f.getAbsolutePath()+File.+)

takeScreenshot--- /storage/emulated/0/Download/8888.png

 E/UiDevice: failed to save screen shot to file

  java.io.FileNotFoundException: /storage/emulated/0/Download/8888.png (Permission denied)

需要添加权限:


新闻名称:androidcts相关
路径分享:http://cdkjz.cn/article/igoicd.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220