UI测试后生成测试报告,利用shell脚本上传svn

ui测试后生成测试报告,把报告保存在某一个固定路径

shell脚本把这个报告上传

#!/bin/bash -ile
#svn下载文件
#svn checkout http://svn.xxx.com/svn/xxxx/trunk/UI/report --username xxx --password dsdfsdf;
svn checkout http://svn.xxx.com.cn/svn/xxxx/trunk/UI/report 
cd report
pwd
#是否存在report 文件,如果存在就删除,这样svn上就不会保存很多文件,只保存一个文件
files=$(ls report*.html 2> /dev/null | wc -l)
if [ $files != "0" ] ;then
    #存在文件就删除
    echo "文件存在"
    svn delete report*.html
    svn commit -m "delete report"
else 
    echo "文件不存在"
fi

#获取报告文件存放id
flag=`cat /Users/abc/autoconf/flag.txt`
echo $flag
#生成报告文件的路径
reportPath="/Users/abc/autoconf/report/report"$flag".html"
#生成的报告文件名
addReportPath=report"$flag".html
echo $reportPath
#如果生成的报告文件存在,就上传svn 判断文件是否存在
if [ -f $reportPath ] ; then 
    echo "报告文件存在"$reportPath
    cp $reportPath .
    svn add $addReportPath
    svn commit -m "add  report"$addFilePath
else
    echo "报告文件不存在"$reportPath
fi

cd .. 
rm -rf report
#重新下载下上传报告的svn文件
svn checkout http://svn.xxx.com/svn/xxx/trunk/UI/report
原文地址:https://www.cnblogs.com/testway/p/9056627.html