How to use get_error_info method in unittest-xml-reporting

Best Python code snippet using unittest-xml-reporting_python

log.py

Source:log.py Github

copy

Full Screen

...23 def error(self, message=''):24 """25 error 日志26 """27 message = self.get_error_info(message)28 logger_detail.error(message)29 30 def info(self, message=''):31 """32 info 日志33 """34 message = self.get_error_info(message)35 logger_detail.info(message)36 37 def warning(self, message=''):38 """39 warning 日志40 """41 message = self.get_error_info(message)42 logger_detail.warning(message)43 44 def debug(self, message=''):45 """46 debug 日志47 """48 message = self.get_error_info(message)49 logger_detail.debug(message)50 51 def critical(self, message=''):52 """53 critical 日志54 """55 message = self.get_error_info(message)56 logger_detail.critical(message)57 58 def get_error_info(self, message):59 """60 获取日志信息61 """62 try:63 info = sys.exc_info()64 for filename, lineno, function, text in traceback.extract_tb(info[2]):65 msg = u"%s line: %s in %s" % (filename, lineno, function)66 message = u"%s;%s\n%s\n" % (message, msg, text)67 sys.exc_clear()68 return message69 except Exception as e:70 return message71 72# traceback--打印详细错误日志 ...

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 unittest-xml-reporting 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