Python腳本解決一些繁瑣的測試問(wèn)題 軟件測試
用Python腳本:根據文件列表“stab_case.txt”上面的文件名稱(chēng),刪除指定文件夾(包括子文件夾)下面的文件。
#coding=utf-8
import os
WORKDIR = os.getcwd()#不必修改
#提供局排錯誤案例信息的報告全集,除非生成的報告名改變否則不必改動(dòng)
g_ResultTxtName = ['stab_case.txt', ]
#如果把該程序拷到Cases\\Case下則不需要設置
#否則寫(xiě)成如這樣的案例存放的絕對路徑'E:\\render\\Cases\\Case'
CasePath = WORKDIR
def deleteFile(filepath):
try:
if not os.path.exists(filepath):
print filepath, "not exist!"
return 0
if not os.path.isfile(filepath):
print filepath, "is not a file!"
return 0
os.remove(filepath)
print "Delete ", filepath, " succeded!"
return 1
except:
print "Delete ", filepath, " failed!"
pass
return 0
def analyseReport(txtPath):
文章來(lái)源于領(lǐng)測軟件測試網(wǎng) http://kjueaiud.com/