How to use _execute_test_step method in rester

Best Python code snippet using rester_python

exc.py

Source:exc.py Github

copy

Full Screen

...24 self.skipped.append(step)25 continue26 @log_capture()27 def _run(l):28 failures = self._execute_test_step(step)29 return failures, l30 f, logs = _run()31 if f:32 self.failed.append((step, Failure(f.errors, "".join(self._format_logs(logs)))))33 else:34 self.passed.append(step)35 return self._result()36 def _result(self):37 d = dict(name=self.case.filename,38 passed=sorted([step.name for step in self.passed]),39 failed=None,40 skipped=sorted([step.name for step in self.skipped]))41 d['failed'] = f = []42 for step, failure in self.failed:43 f.append(dict(name=step.name, errors=failure.errors, logs=failure.output))44 return d45 def _format_logs(self, lc):46 for r in lc.actual():47 yield "%s: %s - %s\n" % (r[1], r[0], r[2])48 def _build_param_dict(self, test_step):49 params = {}50 if hasattr(test_step, 'params') and test_step.params is not None:51 for key, value in test_step.params.items().items():52 params[key] = self.case.variables.expand(value)53 return params54 def _execute_test_step(self, test_step):55 http_client = HttpClient(**self.case.request_opts)56 failures = Failure([], None)57 try:58 method = getattr(test_step, 'method', 'get')59 is_raw = getattr(test_step, 'raw', False)60 self.logger.info('\n=======> Executing TestStep : %s, method : %s', test_step.name, method)61 # process and set up headers62 headers = {}63 if hasattr(test_step, 'headers') and test_step.headers is not None:64 self.logger.debug('Found Headers')65 for key, value in test_step.headers.items().items():66 headers[key] = self.case.variables.expand(value)67 # process and set up params68 params = self._build_param_dict(test_step)...

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