How to use set_platform_results method in autotest

Best Python code snippet using autotest_python

frontend.py

Source:frontend.py Github

copy

Full Screen

...526 platform_map[platform]['Total'].append(hostname)527 new_host_list = platform_map[platform].get(status, []) + [hostname]528 platform_map[platform][status] = new_host_list529 job.results_platform_map = platform_map530 def set_platform_results(self, test_job, platform, result):531 """532 Result must be None, 'FAIL', 'WARN' or 'GOOD'533 """534 if test_job.platform_results[platform] is not None:535 # We're already done, and results recorded. This can't change later.536 return537 test_job.platform_results[platform] = result538 # Note that self.job refers to the metajob we're IN, not the job539 # that we're excuting from here.540 testname = '%s.%s' % (test_job.testname, platform)541 if self.job:542 self.job.record(result, None, testname, status='')543 def poll_job_results(self, tko, job, debug=False):544 """545 Analyse all job results by platform, return:546 False: if any platform has more than one failure547 None: if any platform has more than one machine not yet Good.548 True: if all platforms have at least all-but-one machines Good.549 """550 self._job_test_results(tko, job, debug)551 if job.test_status == {}:552 return None553 self._job_results_platform_map(job, debug)554 good_platforms = []555 failed_platforms = []556 aborted_platforms = []557 unknown_platforms = []558 platform_map = job.results_platform_map559 for platform in platform_map:560 if not job.platform_results.has_key(platform):561 # record test start, but there's no way to do this right now562 job.platform_results[platform] = None563 total = len(platform_map[platform]['Total'])564 completed = len(platform_map[platform].get('Completed', []))565 failed = len(platform_map[platform].get('Failed', []))566 aborted = len(platform_map[platform].get('Aborted', []))567 # We set up what we want to record here, but don't actually do568 # it yet, until we have a decisive answer for this platform569 if aborted or failed:570 bad = aborted + failed571 if (bad > 1) or (bad * 2 >= total):572 platform_test_result = 'FAIL'573 else:574 platform_test_result = 'WARN'575 if aborted > 1:576 aborted_platforms.append(platform)577 self.set_platform_results(job, platform, platform_test_result)578 elif (failed * 2 >= total) or (failed > 1):579 failed_platforms.append(platform)580 self.set_platform_results(job, platform, platform_test_result)581 elif (completed >= 1) and (completed + 1 >= total):582 # if all or all but one are good, call the job good.583 good_platforms.append(platform)584 self.set_platform_results(job, platform, 'GOOD')585 else:586 unknown_platforms.append(platform)587 detail = []588 for status in platform_map[platform]:589 if status == 'Total':590 continue591 detail.append('%s=%s' % (status, platform_map[platform][status]))592 if debug:593 print '%20s %d/%d %s' % (platform, completed, total,594 ' '.join(detail))595 print596 if len(aborted_platforms) > 0:597 if debug:598 print 'Result aborted - platforms: ',...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful