Python's most recent work is the component compatibility test, the original framework has a lot of features are not perfect, need to add! For example, you need to write the results of the AutoIt script to Excel, and the final solution is to use the local log to parse the result!
The following class is added to complete the above functions:
Copy Code code as follows:
Class Autoitresultparser ():
def parseresult (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"):
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
The contents of the Log_file file here are similar to the following:
Copy Code code as follows:
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
Trusteerrapport:
Tntshippingtools:
Installation:success
Tntshippingtools:
Launch:success
wget_1.11.4:
Installation:success
Visualstudio2010_standaloneprofiler:
Uninstallation:success
Tntshippingtools:
Uninstallation:fail