How to use _end_current_test_item method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

reportportal.py

Source:reportportal.py Github

copy

Full Screen

...40 "test results have not been properly synced:",41 file=sys.stderr42 )43 traceback.print_exception(*self._rp_exc_info, file=sys.stderr)44 def _end_current_test_item(self, end_time, status):45 self.service.finish_test_item(end_time=make_time(end_time), status=status)46 def _start_test_item(self, item_type, start_time, name, description, wrapped=False):47 if wrapped:48 self.service.start_test_item(49 item_type="SUITE", start_time=make_time(start_time),50 name=name, description=description51 )52 self.service.start_test_item(53 item_type=item_type, start_time=make_time(start_time),54 name=name, description=description55 )56 def _end_test_item(self, end_time, is_successful, wrapped=False):57 status = "passed" if is_successful else "failed"58 if wrapped:59 self._end_current_test_item(end_time, status=status)60 self._end_current_test_item(end_time, status=status)61 def on_test_session_start(self, event):62 if self._has_rp_error():63 return64 self.service.start_launch(65 name=self.launch_name, description=self.launch_description, start_time=make_time(event.time)66 )67 def on_test_session_end(self, event):68 if self._has_rp_error():69 self._show_rp_error()70 else:71 self.service.finish_launch(end_time=make_time(event.time))72 self.service.terminate()73 if self._has_rp_error():74 self._show_rp_error()75 def on_test_session_setup_start(self, event):76 if self._has_rp_error():77 return78 self._start_test_item(79 item_type="BEFORE_CLASS", start_time=event.time,80 name="session_setup", description="Test Session Setup",81 wrapped=True82 )83 def on_test_session_setup_end(self, event):84 if self._has_rp_error():85 return86 self._end_test_item(87 event.time,88 not self.report.test_session_setup or self.report.test_session_setup.is_successful(),89 wrapped=True90 )91 def on_test_session_teardown_start(self, event):92 if self._has_rp_error():93 return94 self._start_test_item(95 item_type="AFTER_CLASS", start_time=event.time,96 name="session_teardown", description="Test Session Teardown",97 wrapped=True98 )99 def on_test_session_teardown_end(self, event):100 if self._has_rp_error():101 return102 self._end_test_item(103 event.time,104 not self.report.test_session_teardown or self.report.test_session_teardown.is_successful(),105 wrapped=True106 )107 def on_suite_start(self, event):108 if self._has_rp_error():109 return110 suite = event.suite111 self.service.start_test_item(112 item_type="SUITE", start_time=make_time(event.time),113 name=suite.name, description=suite.description,114 tags=make_tags_from_test_tree_node(suite)115 )116 def on_suite_end(self, event):117 if self._has_rp_error():118 return119 self._end_current_test_item(event.time, status="passed")120 def on_suite_setup_start(self, event):121 if self._has_rp_error():122 return123 self._start_test_item(124 item_type="BEFORE_CLASS", start_time=event.time,125 name="suite_setup", description="Suite Setup",126 wrapped=len(event.suite.get_suites()) > 0127 )128 def on_suite_setup_end(self, event):129 if self._has_rp_error():130 return131 suite_data = self.report.get_suite(event.suite)132 self._end_test_item(133 event.time,134 not suite_data.suite_setup or suite_data.suite_setup.is_successful(),135 wrapped=len(event.suite.get_suites()) > 0136 )137 def on_suite_teardown_start(self, event):138 if self._has_rp_error():139 return140 self._start_test_item(141 item_type="AFTER_CLASS", start_time=event.time,142 name="suite_teardown", description="Suite Teardown",143 wrapped=len(event.suite.get_suites()) > 0144 )145 def on_suite_teardown_end(self, event):146 if self._has_rp_error():147 return148 suite_data = self.report.get_suite(event.suite)149 self._end_test_item(150 event.time,151 not suite_data.suite_teardown or suite_data.suite_teardown.is_successful(),152 wrapped=len(event.suite.get_suites()) > 0153 )154 def on_test_start(self, event):155 if self._has_rp_error():156 return157 test = event.test158 self.service.start_test_item(159 item_type="TEST", start_time=make_time(event.time),160 name=test.name, description=test.description,161 tags=make_tags_from_test_tree_node(test)162 )163 def on_test_end(self, event):164 if self._has_rp_error():165 return166 test_data = self.report.get_test(event.test)167 self._end_current_test_item(event.time, test_data.status)168 def _bypass_test(self, test, status, time):169 if self._has_rp_error():170 return171 self.service.start_test_item(172 item_type="TEST", start_time=make_time(time),173 name=test.name, description=test.description, tags=test.tags,174 )175 self._end_current_test_item(time, status=status)176 def on_test_skipped(self, event):177 if self._has_rp_error():178 return179 self._bypass_test(event.test, "skipped", event.time)180 def on_disabled_test(self, event):181 # do not log disabled test, moreover it seems that there is not corresponding status in ReportPortal182 pass183 def on_step_start(self, event):184 if self._has_rp_error():185 return186 self.service.log(make_time(event.time), "--- STEP: %s ---" % event.step_description, "INFO")187 def on_log(self, event):188 if self._has_rp_error():189 return...

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