安装方式
mac:brew install rethinkdb graphicsmagick zeromq protobuf yasm pkg-config
linux:docker
- 拉取镜像
docker pull openstf/stf:latest
docker pull sorccu/adb:latest
docker pull rethinkdb:latest
- 启动容器
rethinkdb,openstf
docker run -d --name rethinkdb -v /srv/rethinkdb:/data --net host rethinkdb rethinkdb --bind all --cache-size 8192 --http-port 8090
docker run -d --name stf --net host openstf/stf stf local --allow-remote
windows: 不建议安装
外网可以访问
用–public-ip
docker run -d --name stf3 --net host openstf/stf stf local --allow-remote --public-ip 192.168.0.103
api
- 获取用户信息
curl -H 'Authorization: \
Bearer 4eea142d8c4a4fee9f8426e7eb7602422ea04144589143a9b9bc60bc8dddc35e' \
http://localhost:7100/api/v1/user
- 获取所有的设备信息,并进行重要字段的提取
curl -H "Authorization: Bearer $token" \
http://localhost:7100/api/v1/devices | \
jq -c '.devices[]|[.serial,.present,.remoteConnectUrl]
- 获取所有的可用设备
curl -H "Authorization: Bearer $token \
" http://localhost:7100/api/v1/devices | \
jq -c '.devices[]|[.serial,.present,.remoteConnectUrl]'| \
grep true | awk -F \" '{print $2}'
授权和连接
function get_device
{
curl -H "Authorization: Bearer $STF_TOKEN" $STF_URL/api/v1/devices | jq -c '.devices[]|[.serial,.present,.remoteConnectUrl]'
}
function get_remote_device
{
get_device | grep true | awk -F \" {'print $4'}
}
function run
{
get_remote_device|while read line; do { nohup adb -s $line shell monkey 1000 &};done
}