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

本文介绍了一种使用Shell脚本实现UI测试报告自动化上传至SVN仓库的方法。具体步骤包括检查并清理旧报告、上传新生成的测试报告,并确保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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值