最近的工作主要是元件相容性測試,原有的框架有很多功能還不完善,需要補充!比如,需要將autoit指令碼的執行結果寫入到excel中,最後的解決方案是使用本地的log來解析這個結果!
'''created on may 3, 2013
@author: berlin
'''class
autoitresultparser():
defparseresult(self, vm_result, log_file):
for case_result in
vm_result.cases_results:
self.
__modifyautoitresult
(case_result, log_file)
def__modifyautoitresult
(self, result, log_file):
items =
myfile = open(log_file, 'rb'
) line =myfile.readline()
count =0
while('' !=line):':
')[0])
count += 1
if(count % 2 ==0):':
')[1])
line =myfile.readline()
myfile.close()
fail_scripts =
length =len(items)
arr = list(range(2, length, 3))
for i in
arr:
test =items[i].lower()
if test.rfind('
success
') == -1:
for script in
fail_scripts:
if script[0] ==result.case_name:
if script[1] == '
installation':
result.install_script_success =false
elif script[1] == '
launch':
result.launch_script_success =false
elif script[1] == '
function':
result.function_script_success =false
else
: result.uninstall_script_success = false
這裡的log_file檔案內容類似如下:
visualstudio2010_standaloneprofiler:installation: success
visualstudio2010_standaloneprofiler:
launch: success
visualstudio2010_standaloneprofiler:
function: fail
taobaobrowser_2.0.0:
citrixofflineplugin_6.5:
installation: success
citrixofflineplugin_6.5:
function: success
tntshippingtools:
installation: success
tntshippingtools:
launch: success
wget_1.11.4:
installation: success
visualstudio2010_standaloneprofiler:
uninstallation: success
tntshippingtools:
uninstallation: fail
vm_result是個例項物件,其成員cases_results下面有很多字段,諸如install_script_success等!
published by windows live writer!
C語言文字檔案解析
把檔案按照行分割成多個檔案 define row max length 80 define fnm max length 12 include include void main char ufilename fnm max length while ch eof ch fgetc fp 讀取單個字...
python之文字檔案的讀取
檔案的讀取一般使用三個方法 read size 從檔案中讀取size個字元,並作為結果返回。readline 讀取一行內容作為結果返回。readlines 文字檔案中,每一行作為乙個字串存入列表中,返回該列表。檔案的讀取 測試檔案讀取 with open r c a.txt r encoding u...
python 讀寫文字檔案
本人最近新學python 用到文字檔案的讀取,經過一番研究,從網上查詢資料,經過測試,總結了一下讀取文字檔案的方法.a f open filename r content f.read decode utf 8 b f codecs.open encoding utf 8 content f.rea...