STF STF 使用系列心得 [安装篇]

狂师 · 2016年10月14日 · 最后由 CC-q 回复于 2018年10月30日 · 14503 次阅读

前言

好久,没来论坛发表文章了,或者换句说,之前也很少在testerhome上发表太多言论,看到现在大家对技术的追逐越来越积极,testerhome也越之壮大,也想为论坛贡献一点帛薄之力吧,前段时间正好在公司推APP UI自动化的项目 ,中间也抽了一两天时间体验了一下STF平台【移动设备管理控制工具】,借此机会,将STF平台的一些使用心得及遇到问题的解决方案分享给大家。

目的【STF环境搭建】

具体STF环境安装搭建过程,建议大家可以参考下述两篇文章
MAC 下 STF 的环境搭建和运行(https://testerhome.com/topics/3083
WEB 端批量移动设备管理控制工具 STF 的环境搭建和运行(https://testerhome.com/topics/2988)

可以遇到的问题 【解决方案】

一、实际在搭建环境过程中,遇到protobuf不支持3.0,如果环境安装完后,启动stf local提示:ReqlDriverError: ERROR: Received an unsupported protocol version. This port is for RethinkDB queries. Does your client driver version not match the server? 也是由于protobuf版本的原因,需除到2.x系列,本文降到2.6版本

下载地址: https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
tar -zxvf protobuf-2.6.1.tar.gz
cd protobuf-2.6.1/
./configure
make
make check
sudo make install

重新至2.6.1版本后

安装完STF所有环境后,执行stf doctor来检查环境安装是否都正常

将protobuf降到2.x版本后

如果环境均检查正常,则环境到此为止,一切正常!

启动方式

一、启动rethinkDB
指定端口和缓冲大小启动:rethinkdb --bind all --cache-size 8192 --http-port 8090

二、启动stf服务端
指定ip和允许远程连接启动:stf local --public-ip xx.xx.xx.xx --allow-remote

注:登录界面中,用户名和邮箱输入符合规则即可

小绪

本来今晚准备将其它STF改造一并发出,但中间由于其它事情耽搁,后面再补STF代码改造部分,今晚就先发安装篇吧。
==> (好吧,主要的原因是,写了一半文章后,群里面喊玩微交易,结果去玩微交易,刚开始赢了几千,结果没见好就收,想继续赢,到后面行情波动太大,又全部吐出来了,所以无心再写文章了 )

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 28 条回复 时间 点赞

对具体改造了什么比较感兴趣。

狂师 [该话题已被删除] 中提及了此贴 10月15日 16:04

楼主的APP UI自动化的项目 收益如何?

同问,ui自动化收益如何,我还在研究

狂师 STF 使用系列心得 [改造篇] 中提及了此贴 12月08日 21:16

@mikezhou 请教下我搭建好了,可是在线手机数不能超过37台,不知道是什么原因,要怎么解决 ?

clydeiMac:~ cly$ stf doctor
/usr/local/lib/node_modules/stf/node_modules/bindings/bindings.js:91
throw err
^

Error: Could not locate the bindings file. Tried:
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/out/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/out/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/default/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/compiled/6.10.1/darwin/x64/zmq.node
at bindings (/usr/local/lib/node_modules/stf/node_modules/bindings/bindings.js:88:9)
at Object. (/usr/local/lib/node_modules/stf/node_modules/zmq/lib/index.js:6:30)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/stf/node_modules/zmq/index.js:2:18)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)

我报这个错误

loneyao 回复

我也碰到这个问题了,该怎么解决呢?

linkin 回复

你解决了吗?我还是不知道如何去解决

clydeiMac:~ cly$ stf local --public-ip 192.168.28.2 --allow-remote
INF/util:procutil 10270 [] Forking "/usr/local/lib/node_modules/stf/lib/cli.js migrate"
INF/db 10271 [
] Connecting to 127.0.0.1:28015
INF/db:setup 10271 [] Database "stf" already exists
INF/db:setup 10271 [
] Table "users" already exists
INF/db:setup 10271 [] Table "accessTokens" already exists
INF/db:setup 10271 [
] Table "vncauth" already exists
INF/db:setup 10271 [] Table "devices" already exists
INF/db:setup 10271 [
] Table "logs" already exists
INF/db:setup 10271 [] Index "users"."adbKeys" already exists
INF/db:setup 10271 [
] Index "accessTokens"."email" already exists
INF/db:setup 10271 [] Index "vncauth"."response" already exists
INF/db:setup 10271 [
] Index "vncauth"."responsePerDevice" already exists
INF/db:setup 10271 [] Index "devices"."owner" already exists
INF/db:setup 10271 [
] Index "devices"."present" already exists
INF/db:setup 10271 [] Waiting for index "users"."adbKeys"
INF/db:setup 10271 [
] Waiting for index "accessTokens"."email"
INF/db:setup 10271 [] Waiting for index "vncauth"."response"
INF/db:setup 10271 [
] Waiting for index "vncauth"."responsePerDevice"
INF/db:setup 10271 [] Waiting for index "devices"."owner"
INF/db:setup 10271 [
] Waiting for index "devices"."present"
INF/db:setup 10271 [] Index "devices"."providerChannel" already exists
INF/db:setup 10271 [
] Waiting for index "devices"."providerChannel"
INF/db:setup 10271 [] Index "users"."adbKeys" is ready
INF/db:setup 10271 [
] Index "accessTokens"."email" is ready
INF/db:setup 10271 [] Index "vncauth"."responsePerDevice" is ready
INF/db:setup 10271 [
] Index "vncauth"."response" is ready
INF/db:setup 10271 [] Index "devices"."providerChannel" is ready
INF/db:setup 10271 [
] Index "devices"."present" is ready
INF/db:setup 10271 [] Index "devices"."owner" is ready
INF/util:procutil 10270 [
] Forking "/usr/local/lib/node_modules/stf/lib/cli.js triproxy app001 --bind-pub tcp://127.0.0.1:7111 --bind-dealer tcp://127.0.0.1:7112 --bind-pull tcp://127.0.0.1:7113"
INF/util:procutil 10270 [] Forking "/usr/local/lib/node_modules/stf/lib/cli.js triproxy dev001 --bind-pub tcp://127.0.0.1:7114 --bind-dealer tcp://127.0.0.1:7115 --bind-pull tcp://127.0.0.1:7116"
INF/util:procutil 10270 [
] Forking "/usr/local/lib/node_modules/stf/lib/cli.js processor proc001 --connect-app-dealer tcp://127.0.0.1:7112 --connect-dev-dealer tcp://127.0.0.1:7115"
INF/util:procutil 10270 [] Forking "/usr/local/lib/node_modules/stf/lib/cli.js processor proc002 --connect-app-dealer tcp://127.0.0.1:7112 --connect-dev-dealer tcp://127.0.0.1:7115"
INF/util:procutil 10270 [
] Forking "/usr/local/lib/node_modules/stf/lib/cli.js reaper reaper001 --connect-push tcp://127.0.0.1:7116 --connect-sub tcp://127.0.0.1:7111"
INF/util:procutil 10270 [] Forking "/usr/local/lib/node_modules/stf/lib/cli.js provider --name clydeiMac.local --min-port 7400 --max-port 7700 --connect-sub tcp://127.0.0.1:7114 --connect-push tcp://127.0.0.1:7116 --group-timeout 900 --public-ip 192.168.28.2 --storage-url http://localhost:7100/ --adb-host 127.0.0.1 --adb-port 5037 --vnc-initial-size 600x800 --allow-remote"
INF/util:procutil 10270 [
] Forking "/usr/local/lib/node_modules/stf/lib/cli.js auth-mock --port 7120 --secret kute kittykat --app-url http://192.168.28.2:7100/"
INF/util:procutil 10270 [] Forking "/usr/local/lib/node_modules/stf/lib/cli.js app --port 7105 --secret kute kittykat --auth-url http://192.168.28.2:7100/auth/mock/ --websocket-url http://192.168.28.2:7110/"
INF/util:procutil 10270 [
] Forking "/usr/local/lib/node_modules/stf/lib/cli.js api --port 7106 --secret kute kittykat --connect-push tcp://127.0.0.1:7113 --connect-sub tcp://127.0.0.1:7111"
INF/util:procutil 10270 [] Forking "/usr/local/lib/node_modules/stf/lib/cli.js websocket --port 7110 --secret kute kittykat --storage-url http://localhost:7100/ --connect-sub tcp://127.0.0.1:7111 --connect-push tcp://127.0.0.1:7113"
INF/util:procutil 10270 [
] Forking "/usr/local/lib/node_modules/stf/lib/cli.js storage-temp --port 7102"
INF/util:procutil 10270 [] Forking "/usr/local/lib/node_modules/stf/lib/cli.js storage-plugin-image --port 7103 --storage-url http://localhost:7100/"
INF/util:procutil 10270 [
] Forking "/usr/local/lib/node_modules/stf/lib/cli.js storage-plugin-apk --port 7104 --storage-url http://localhost:7100/"
INF/util:procutil 10270 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli.js poorxy --port 7100 --app-url http://localhost:7105/ --auth-url http://localhost:7120/ --api-url http://localhost:7106/ --websocket-url http://localhost:7110/ --storage-url http://localhost:7102/ --storage-plugin-image-url http://localhost:7103/ --storage-plugin-apk-url http://localhost:7104/"
/usr/local/lib/node_modules/stf/node_modules/bindings/bindings.js:91
throw err
^

Error: Could not locate the bindings file. Tried:
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/out/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/out/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/default/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/compiled/6.10.1/darwin/x64/zmq.node
at bindings (/usr/local/lib/node_modules/stf/node_modules/bindings/bindings.js:88:9)
at Object. (/usr/local/lib/node_modules/stf/node_modules/zmq/lib/index.js:6:30)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/stf/node_modules/zmq/index.js:2:18)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
FTL/cli:local 10270 [] Child process had an error ExitError: Exit code "1"
at ChildProcess. (/usr/local/lib/node_modules/stf/lib/util/procutil.js:49:23)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
INF/cli:local 10270 [
] Shutting down all child processes
/usr/local/lib/node_modules/stf/node_modules/bindings/bindings.js:91
throw err
^

Error: Could not locate the bindings file. Tried:
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/out/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/Debug/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/out/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/Release/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/build/default/zmq.node
→ /usr/local/lib/node_modules/stf/node_modules/zmq/compiled/6.10.1/darwin/x64/zmq.node
at bindings (/usr/local/lib/node_modules/stf/node_modules/bindings/bindings.js:88:9)
at Object. (/usr/local/lib/node_modules/stf/node_modules/zmq/lib/index.js:6:30)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/stf/node_modules/zmq/index.js:2:18)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)

loneyao 回复

我是用的虚拟机,重装系统然后将环境和依赖全部重新安装了一遍。
估计是之前安装的时候中间某一步出了问题

请问可以在Windows环境安装吗

wangpengfei100 回复

windows可能用docker

狂师 #15 · 2017年04月23日 作者
wangpengfei100 回复

如果只是尝尝鲜,在windows上就用docker方式来装,如果是想长期用于项目用,还是建议直接装到mac或Liunx服务器上。

帮忙看下我搭建过程中的错误
INF/util:procutil 127572 [*] Forking "/usr/local/lib/node_modules/stf/lib/cli.js poorxy --port 7100 --app-url http://localhost:7105/ --auth-url http://localhost:7120/ --api-url http://localhost:7106/ --websocket-url http://localhost:7110/ --storage-url http://localhost:7102/ --storage-plugin-image-url http://localhost:7103/ --storage-plugin-apk-url http://localhost:7104/"
/usr/local/lib/node_modules/stf/node_modules/_bindings@1.2.1@bindings/bindings.js:83
throw e
^

Error: libzmq.so.5: cannot open shared object file: No such file or directory
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at bindings (/usr/local/lib/node_modules/stf/node_modules/_bindings@1.2.1@bindings/bindings.js:76:44)
at Object. (/usr/local/lib/node_modules/stf/node_modules/_zmq@2.15.3@zmq/lib/index.js:6:30)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
FTL/cli:local 127572 [] Child process had an error ExitError: Exit code "1"
at ChildProcess. (/usr/local/lib/node_modules/stf/lib/util/procutil.js:49:23)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
INF/cli:local 127572 [
] Shutting down all child processes
/usr/local/lib/node_modules/stf/node_modules/_bindings@1.2.1@bindings/bindings.js:83
throw e
^

Error: libzmq.so.5: cannot open shared object file: No such file or directory
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at bindings (/usr/local/lib/node_modules/stf/node_modules/_bindings@1.2.1@bindings/bindings.js:76:44)
at Object. (/usr/local/lib/node_modules/stf/node_modules/_zmq@2.15.3@zmq/lib/index.js:6:30)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)

回复

从这句“Error: libzmq.so.5: cannot open shared object file: No such file or directory” error message来看,你没有安装ZeroMQ library。安装方法可参考https://testerhome.com/topics/2988 中的第7,8节。如果正常安装后这个file会安装到 /usr/local/lib/libzmq.so.5

@emma.ren 也出现了 Error: libzmq.so.5: cannot open shared object file: No such file or directory

但是 /usr/local/lib/libzmq.so.5有这个文件

emma.ren 回复

非常感谢你,由于自己是小白 尝试了提到的方法,但是还是有问题,出问题的系统是centos,怎么也没装上,很多人说缺少依赖,后来换成了ubunut系统,很顺利的就搭建成功了

@mikezhou 求助,stf doctor检测有个错误😭

导致stf local的时候,有个手机一直连不上;

FTL/device 9421 [52bb154e] Setup had an error Error: Cannot find module '/usr/local/lib/node_modules/stf/node_modules/_jpeg-turbo@0.4.0@jpeg-turbo/lib/binding/node-v57-linux-x64/jpegturbo.node'

蓝蓝 回复

问题已解决,stf能用了。

请问怎么在STF上执行appium脚本?

23楼 已删除
蓝蓝 回复

你好,你的问题最后怎么解决的,我的stf doctor没有问题,但是报错和你的一样的

雾里看花 回复

多捣鼓几次,然后就好了😂

大神,stf怎么在linux的后台运行,我不想看到“运行的日志信息”

雾里看花 回复

请问问题解决了吗?

蓝蓝 回复

大师,请问怎么解决的啊?

29楼 已删除

我在stf搭建的机器上,插了android设备。adb 能显示,什么网页面上显示不了呢?急求。

George 回复

你好,请问你的问题解决了么?

雾里看花 回复

你好,我的跟你一样的情况,你解决了吗?

@lengyao88 @laige232 转到stf工程目录,执行npm rebuild 我是这样解决的

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册