How to use on_log_url method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

reportportal.py

Source:reportportal.py Github

copy

Full Screen

...204 "name": osp.basename(event.attachment_path),205 "data": fh.read(),206 "mime": mimetypes.guess_type(abspath)[0] or "application/octet-stream"207 })208 def on_log_url(self, event):209 if self._has_rp_error():210 return211 if event.url_description and event.url_description != event.url:212 message = "%s: %s" % (event.url_description, event.url)213 else:214 message = event.url215 self.service.log(make_time(event.time), message, "INFO")216class ReportPortalReportingSessionParallelized(ReportingSession):217 def __init__(self, *args):218 self._session = ReportPortalReportingSession(*args)219 def on_test_session_end(self, _):220 event_manager = SyncEventManager.load()221 event_manager.add_listener(self._session)222 replay_report_events(self._session.report, event_manager)...

Full Screen

Full Screen

writer.py

Source:writer.py Github

copy

Full Screen

...120 def on_log_attachment(self, event):121 self._add_step_log(122 Attachment(event.attachment_description, event.attachment_path, event.as_image, event.time), event123 )124 def on_log_url(self, event):125 self._add_step_log(126 Url(event.url_description, event.url, event.time), event...

Full Screen

Full Screen

backend.py

Source:backend.py Github

copy

Full Screen

1'''2Created on Mar 29, 20163@author: nicolas4'''5import os6from lemoncheesecake.helpers.orderedset import OrderedSet7from lemoncheesecake.exceptions import LemoncheesecakeException8_NEGATION_FLAGS = "-^~"9class ReportingSession(object):10 pass11class ReportingSessionBuilderMixin(object):12 def create_reporting_session(self, report_dir, report, parallel, report_saving_strategy):13 raise NotImplementedError()14class ReportSerializerMixin(object):15 def save_report(self, filename, report):16 raise NotImplementedError()17class ReportUnserializerMixin(object):18 def load_report(self, filename):19 raise NotImplementedError()20class ReportingBackend(object):21 def get_name(self):22 raise NotImplementedError()23 def is_available(self):24 return True25class FileReportSession(ReportingSession):26 def __init__(self, report_filename, report, reporting_backend, report_saving_strategy):27 self.report_filename = report_filename28 self.report = report29 self.reporting_backend = reporting_backend30 self.report_saving_strategy = report_saving_strategy31 def _save(self):32 self.reporting_backend.save_report(self.report_filename, self.report)33 def _handle_event(self, event):34 report_must_be_saved = self.report_saving_strategy and self.report_saving_strategy(event, self.report)35 if report_must_be_saved:36 self._save()37 on_test_session_setup_end = _handle_event38 on_test_session_teardown_end = _handle_event39 on_suite_setup_end = _handle_event40 on_suite_teardown_end = _handle_event41 on_test_end = _handle_event42 on_suite_end = _handle_event43 on_log = _handle_event44 on_log_attachment = _handle_event45 on_log_url = _handle_event46 on_check = _handle_event47 def on_test_session_end(self, event):48 # no matter what is the report_saving_strategy,49 # the report will always be saved at the end of tests50 self._save()51class FileReportBackend(ReportingBackend, ReportSerializerMixin, ReportingSessionBuilderMixin):52 def get_report_filename(self):53 raise NotImplementedError()54 def create_reporting_session(self, report_dir, report, parallel, report_saving_strategy):55 return FileReportSession(56 os.path.join(report_dir, self.get_report_filename()), report, self, report_saving_strategy57 )58def filter_available_reporting_backends(backends):59 return list(filter(lambda backend: backend.is_available(), backends))60def get_reporting_backends():61 from lemoncheesecake.reporting.backends import REPORTING_BACKENDS62 return list(63 filter(64 lambda backend: backend.is_available(),65 (backend_class() for backend_class in REPORTING_BACKENDS)66 )67 )68def get_reporting_backend_names(default_names, custom_names):69 if all(name[0] not in ("+" + _NEGATION_FLAGS) for name in custom_names): # fixed list70 return custom_names71 elif all(name[0] in ("+" + _NEGATION_FLAGS) for name in custom_names): # turn on/off directives72 names = OrderedSet(default_names)73 for specified_name in custom_names:74 if specified_name[0] == "+": # turn on75 names.add(specified_name[1:])76 else: # turn off77 try:78 names.remove(specified_name[1:])79 except KeyError:80 raise ValueError(81 "reporting backend '%s' is not among the default reporting backends" % specified_name[1:]82 )83 return names84 else:85 raise ValueError(86 "either the custom reporting backends must be fixed backend list, "87 "or a list of turn on/off (+ / ^) directives"88 )89def parse_reporting_backend_names_expression(expr):90 return list(filter(bool, expr.split(" ")))91def get_reporting_backend_by_name(name):92 try:93 return next(backend for backend in get_reporting_backends() if backend.get_name() == name)94 except StopIteration:95 raise KeyError()96def get_reporting_backends_for_test_run(available_backends, backend_names):97 backends = []98 for backend_name in backend_names:99 try:100 backend = available_backends[backend_name]101 except KeyError:102 raise LemoncheesecakeException("Unknown reporting backend '%s'" % backend_name)103 if not isinstance(backend, ReportingSessionBuilderMixin):104 raise LemoncheesecakeException("Reporting backend '%s' is not suitable for test run" % backend_name)105 backends.append(backend)...

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 Lemoncheesecake 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