通過nose直接將allure報告作爲一個可以遠程連接的網站打開

前置

服務器上安裝了nose、allure和pytest用例;

使用方法

先用pytest和allure生成測試報告,而後使用allure open -h 127.0.0.1 -p 8083 ./report/將生成的html文件通過瀏覽器進行查看,report即爲allure生成的報告所在的目錄,而後即可通過"http://服務器ip:8083"來訪問這個allure報告了;
如下是用過的一個用於自動運行用例並打開allure報告服務的shell腳本:

#! /bin/bash
port=8083
PID=`ps -ef | grep $port | grep -v grep | awk '{print $2}'`
if [ -n "$PID" ];then
    echo "`date +%F%H%M%S` testReport service $PID is running, stop it"
    kill -9 $PID
fi
cd /usr/games/test/pytest/saasapitest
echo "`date +%F%H%M%S` start switch to environment $1"
echo "useEnv=$1" > config.properties
sleep 2
echo "`date +%F%H%M%S` start running test"
/usr/local/python3/bin/pytest --alluredir report/xml
echo "`date +%F%H%M%S` start generate allure repot"
allure generate report/xml -o report/html --clean
echo "`date +%F%H%M%S` start to startup report service,port:$port"
nohup allure open -h 10.1.254.63 -p $port report/html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章