Commit e3e335dc authored by Xiaowu Zhang's avatar Xiaowu Zhang

run-zelenium-test: save current test result event error raised

parent c4099132
...@@ -149,6 +149,18 @@ def main(): ...@@ -149,6 +149,18 @@ def main():
WebDriverWait(browser, args.max_duration).until(EC.presence_of_element_located(( WebDriverWait(browser, args.max_duration).until(EC.presence_of_element_located((
By.XPATH, '//td[@id="testRuns" and contains(text(), "%i")]' % test_count By.XPATH, '//td[@id="testRuns" and contains(text(), "%i")]' % test_count
))) )))
except:
test_line_dict['UnexpectedException'] = {
'test_count': 1,
'error_count': 0,
'failure_count': 1,
'skip_count': 0,
'duration': 1,
'command': url,
'stdout': agent,
'stderr': traceback.format_exc()
}
finally:
execution_duration = round(time.time() - start_time, 2) execution_duration = round(time.time() - start_time, 2)
if test_count: if test_count:
test_execution_duration = execution_duration / test_count test_execution_duration = execution_duration / test_count
...@@ -175,9 +187,20 @@ def main(): ...@@ -175,9 +187,20 @@ def main():
for tr in tbody[1:]: for tr in tbody[1:]:
# First td is the main title # First td is the main title
test_name = tr[0][0].text test_name = tr[0][0].text
if len(tr) == 1:
test_line_dict[test_name] = {
'test_count': 1,
'error_count': 0,
'failure_count': 1,
'skip_count': 0,
'duration': 0,
'command': url,
'stdout': agent,
'stderr': '',
'html_test_result': 'Not Executed due to saucelabs related error'
}
else:
skip_count = success_count = error_count = 0 skip_count = success_count = error_count = 0
test_table = tr[1].xpath('.//table')[0] test_table = tr[1].xpath('.//table')[0]
test_tbody = tr[1].xpath('.//tbody')[0] test_tbody = tr[1].xpath('.//tbody')[0]
...@@ -203,18 +226,6 @@ def main(): ...@@ -203,18 +226,6 @@ def main():
'stderr': '', 'stderr': '',
'html_test_result': etree.tostring(test_table) 'html_test_result': etree.tostring(test_table)
} }
except:
test_line_dict['UnexpectedException'] = {
'test_count': 1,
'error_count': 0,
'failure_count': 1,
'skip_count': 0,
'duration': 1,
'command': url,
'stdout': agent,
'stderr': traceback.format_exc()
}
finally:
browser.quit() browser.quit()
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment