コード例 #1
0
def pytest_terminal_summary(terminalreporter, exitstatus):
    "add additional section in terminal summary reporting."
    if pytest.config.getoption("-S").lower() == 'y':
        post_test_reports_to_slack.post_reports_to_slack()
    elif pytest.config.getoption("--email_pytest_report").lower() == 'y':
        #Initialize the Email_Pytest_Report object
        email_obj = Email_Pytest_Report()
        # Send html formatted email body message with pytest report as an attachment
        email_obj.send_test_report_email(html_body_flag=True,attachment_flag=True,report_file_path= 'default')

    if pytest.config.getoption("--tesults").lower() == 'y':
        Tesults.post_results_to_tesults()
コード例 #2
0
ファイル: Base_Page.py プロジェクト: sonumandal95/evaluation1
 def add_tesults_case(self, name, desc, suite, result_flag, msg='', files=[], params={}, custom={}):
     "Update Tesults with test results"
     if self.tesults_flag is True:
         result = "unknown"
         failReason = ""
         if result_flag == True:
             result = "pass"
         if result_flag == False:
             result = "fail"
             failReason = msg
         for image in self.images:
             files.append(self.screenshot_dir + os.sep + image + '.png')
         self.images = []
         caseObj = {'name': name, 'suite': suite, 'desc': desc, 'result': result, 'reason': failReason, 'files': files, 'params': params}
         for key, value in custom.items():
             caseObj[key] = str(value)
         Tesults.add_test_case(caseObj)
コード例 #3
0
def pytest_terminal_summary(terminalreporter, exitstatus):
    "add additional section in terminal summary reporting."
    try:
        if terminalreporter.config.getoption("--slack_flag").lower() == 'y':
            post_test_reports_to_slack.post_reports_to_slack()
        if terminalreporter.config.getoption(
                "--email_pytest_report").lower() == 'y':
            #Initialize the Email_Pytest_Report object
            email_obj = Email_Pytest_Report()
            # Send html formatted email body message with pytest report as an attachment
            email_obj.send_test_report_email(html_body_flag=True,
                                             attachment_flag=True,
                                             report_file_path='default')
        if terminalreporter.config.getoption("--tesults").lower() == 'y':
            Tesults.post_results_to_tesults()

    except Exception as e:
        print("Exception when trying to run test: %s" % __file__)
        print("Python says:%s" % str(e))