STF (Smartphone Test Farm) is a mobile device management platform that can perform remote management, debugging, remote desktop monitoring and other operations on mobile devices. Android and iOS devices are supported. A device management and scheduling platform can be built on the basis of stf.
If you encounter problems in the following construction steps, please refer to the detailed explanation of common problems in building stf on Mac-2023
1. Construction steps
Connecting Android devices depends on sdk and java environment;
1. Install and configure adb
sdk.zip, decompress it and put it in the code folder (custom);
The path of sdk: direct command+c folder, pasted out is the path;
Open .bash_profile to configure environment variables;
export ANDROID_HOME=/Users/用户名/Documents/code/sdk(这里换成自己的路径)
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
Enter the command source .bash_profile in the terminal to make the environment variable take effect;
Verify that adb was installed successfully:
Enter adb to view the command;
Connect the mobile phone, enter adb devices in the terminal, and the connection is successful.
2. Install and configure jdk
Installation tutorial https://www.jianshu.com/p/42041d4e6756
Download address http://www.oracle.com
To view the java version, enter java -version in the terminal;
View java_home, terminal input java_home -V;
Record the java installation path;
Mine is /Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home
Configure environment variables
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home (这里换成自己的路径)
PATH=$JAVA_HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export JAVA_HOME
export PATH
export CLASSPATH
After configuring the environment variable, verify: terminal input echo $JAVA_HOME
3. Install nvm
brew install nvm
After the installation is successful, configure the environment variables according to the prompts
vim .bash_profile
Add the following content
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
After typing: wq to save and exit editing
source ~/.bash_profile refresh environment variables
nvm 常用命令
nvm install 版本号-- 安装指定node版本
nvm uninstall 版本号-- 删除指定node版本
nvm use 版本号 --切换使用指定的node版本
nvm ls 列出所有安装的node版本 nvm ls-remote
nvm current 显示当前的node版本
注意:切换版本的时候,要先安装(如果没有该版本的话),再使用
After configuring the environment variables, verify that the nvm installation is successful
nvm -v
4. Install node.js
stf depends on the 8.x version of node
nvm install v8.14.0
Verify that the node installation is successful
node -v
npm -v
5. Install the database rethinkdb
brew install rethinkdb
After the installation is complete, open the browser http://localhost:8080/ , if the information of the local rethinkdb database can be returned normally, the installation is successful
6. Install the stf dependency package
brew install graphicsmagick zeromq protobuf yasm pkg-config
7. Install stf
At present, openstf has been archived, and devicefarmer stf is still being maintained and developed.
(1) The latest stf-devicefarmer stf
https://github.com/DeviceFarmer/stf
git clone https://github.com/DeviceFarmer/stf.git
After pulling the code, install
npm install -g @devicefarmer/stf
(2)openstf
https://github.com/openstf/stf
git clone https://github.com/openstf/stf.git
(3) Install using npm
This method takes a long time and is prone to failure. It is recommended to use the git clone method.
npm install -g stf
(4) Verify that the stf installation is successful
stf doctor
2. Startup steps
Start rethinkdb in a command line window, and then open a new window to start stf
1. Start rethinkdb
rethinkdb
2. Start the stf service
stf local
3. Open the browser and enter the address http://localhost:7100/auth/mock/ to access the local stf platform
Enter a valid username and email to log in;