增加了如下一个类来完成上述功能:
代码如下:
def __ModifyAutoItResult(self, result, log_file):
items = []
myfile = open(log_file, 'rb')
line = myfile.readline()
count = 0
while('' != line):
items.append(line.split(':')[0])
count += 1
if(count % 2 == 0):
items.append(line.split(':')[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:
fail_scripts.append((items[i - 2], items[i - 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文件内容类似如下:
代码如下: