zoukankan      html  css  js  c++  java
  • Mac安装stf

    1.brew install rethinkdb graphicsmagick zeromq protobuf yasm pkg-config
    2.node版本8.x我的是8.15.0
    3.npm install -g stf 或者cnpm install -g stf
    4.后天启动数据库:nohup rethinkdb &
    5.启动STF的客户端:stf local --public-ip 本机IP --allow-remote
    例如:stf local --public-ip 192.168.1.102 --allow-remote
    在浏览器访问:http://192.168.0.101:7100/
    6.常用的接口脚本

    #!/usr/bin/env bash
    STF_TOKEN=4df3f1f8232d459aa83a4ffb15ed1d44695868e40fc7462892adc5ea0ac19d63
    #STF_URL=http://39.105.132.200:7100
    STF_URL=http://127.0.0.1:7100
    DEVICE_SERIAL="emulator-5554"
    # 申请设备
    function add_device() {
        response=$(curl -X POST -H "Content-Type: application/json" 
            -H "Authorization: Bearer $STF_TOKEN" 
            --data "{"serial": "$DEVICE_SERIAL"}" $STF_URL/api/v1/user/devices)
    
        success=$(echo "$response" | jq .success | tr -d '"')
        description=$(echo "$response" | jq .description | tr -d '"')
    
        if [ "$success" != "true" ]; then
            echo "Failed because $description"
            echo exit 1
        fi
    
        echo "Device $DEVICE_SERIAL added successfully"
    }
    # 远程链接设备
    function remote_connect() {
        response=$(curl -X POST 
            -H "Authorization: Bearer $STF_TOKEN" 
            $STF_URL/api/v1/user/devices/$DEVICE_SERIAL/remoteConnect)
    
        success=$(echo "$response" | jq .success | tr -d '"')
        description=$(echo "$response" | jq .description | tr -d '"')
    
        if [ "$success" != "true" ]; then
            echo "Failed because $description"
            echo exit 1
        fi
        remote_connect_url=$(echo "$response" | jq .remoteConnectUrl | tr -d '"')
        echo $remote_connect_url
    
        adb connect $remote_connect_url
    
        echo "Device $DEVICE_SERIAL remote connected successfully"
    }
    # 移除设备
    function remove_device() {
        # 断开设备链接
        adb disconnect $remote_connect_url
        response=$(curl -X DELETE 
            -H "Authorization: Bearer $STF_TOKEN" 
            $STF_URL/api/v1/user/devices/$DEVICE_SERIAL)
    
        success=$(echo "$response" | jq .success | tr -d '"')
        description=$(echo "$response" | jq .description | tr -d '"')
    
        if [ "$success" != "true" ]; then
            echo "Failed because $description"
            echo exit 1
        fi
    
        echo "Device $DEVICE_SERIAL removed successfully"
    }
    function run_device() {
        add_device
        remote_connect 
        sleep 2
        adb devices
        remote_device=$remote_connect_url
        java -jar /Users/anxiaodong/learn/appcrawler/appcrawler-2.4.0-jar-with-dependencies.jar 
        -c /Users/anxiaodong/learn/appcrawler/xueqie.yml 
        --capability "udid=${remote_device}, systemPort=1${remote_device#*:}, appPackage=com.xueqiu.android,appActivity=.view.WelcomeActivityAlias"
        remove_device
    }
    function every_device() {
        #获得可用设备列表
        devices=$(curl -H "Authorization: Bearer $STF_TOKEN" $STF_URL/api/v1/devices | jq -r '.devices[] | select(.present==true)|.serial ')
        for DEVICE_SERIAL in $devices; do
        {   
            add_device
            remote_connect
            sleep 2
            remote_device=$remote_connect_url
            eval $1
            adb disconnect $remote_device
            sleep 2
            remove_device
        } &
        done
    }
    
    
  • 相关阅读:
    linux 分析 目标文件 的命令
    bss,data,text,rodata,堆,栈,常量段
    Linux进程地址空间详解
    机器周期,指令周期,时钟周期,节拍与晶振
    银行家算法——C语言(11计科1班-孙鹏启——修正)
    bash —— bind ( 一个功能强大的组合键! Alt + . )
    【5002】排版问题
    【?】【7007】栈、模拟
    【u235】背单词
    【t076】竞赛排名
  • 原文地址:https://www.cnblogs.com/an5456/p/11531153.html
Copyright © 2011-2022 走看看