Update testrailreport and threads

Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
Serhy 2021-09-20 18:23:06 +03:00
parent ca273faadd
commit 6387bba9f5
No known key found for this signature in database
GPG Key ID: 5D7C4B9E2B6F500B
2 changed files with 6 additions and 8 deletions

View File

@ -143,7 +143,7 @@ class TestrailReport(BaseTestReport):
ids_failed_test.append(test.testrail_case_id) ids_failed_test.append(test.testrail_case_id)
case_title = '\n' case_title = '\n'
case_title += '-------\n' case_title += '-------\n'
case_title += "### %s) ID %s: [%s](%s) \n" % (i + 1, test.testrail_case_id, test.name, test_rail_link) case_title += "## %s) ID %s: [%s](%s) \n" % (i + 1, test.testrail_case_id, test.name, test_rail_link)
error ="```%s```\n" % last_testrun.error[:255] error ="```%s```\n" % last_testrun.error[:255]
for job_id, f in last_testrun.jobs.items(): for job_id, f in last_testrun.jobs.items():
case_info = "Logs for device %d: [steps](%s), [failure screenshot](%s)"\ case_info = "Logs for device %d: [steps](%s), [failure screenshot](%s)"\
@ -160,7 +160,7 @@ class TestrailReport(BaseTestReport):
def get_run_results(self): def get_run_results(self):
return self.get('get_results_for_run/%s' % self.run_id) return self.get('get_results_for_run/%s' % self.run_id)['results']
def is_run_successful(self): def is_run_successful(self):
for test in self.get_run_results(): for test in self.get_run_results():
@ -171,7 +171,7 @@ class TestrailReport(BaseTestReport):
def get_test_result_link(self, test_run_id, test_case_id): def get_test_result_link(self, test_run_id, test_case_id):
try: try:
test_id = self.get('get_results_for_case/%s/%s' % (test_run_id, test_case_id))[0]['test_id'] test_id = self.get('get_results_for_case/%s/%s' % (test_run_id, test_case_id))['results'][0]['test_id']
return '%stests/view/%s' % (self.url, test_id) return '%stests/view/%s' % (self.url, test_id)
except KeyError: except KeyError:
return None return None

View File

@ -6,14 +6,12 @@ import json
from support.appium_container import AppiumContainer from support.appium_container import AppiumContainer
from support.test_data import TestSuiteData from support.test_data import TestSuiteData
async def start_threads(quantity: int, func: type, returns: dict, *args):
@asyncio.coroutine
def start_threads(quantity: int, func: type, returns: dict, *args):
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
for i in range(quantity): for i in range(quantity):
returns[i] = loop.run_in_executor(None, func, *args) returns[i] = loop.run_in_executor(None, func, *args)
for k in returns: for k in returns:
returns[k] = yield from returns[k] returns[k] = await returns[k]
return returns return returns