How to use __run_test_methods method in Testify

Best Python code snippet using Testify_python

test_case.py

Source:test_case.py Github

copy

Full Screen

...169 ) as class_fixture_failures:170 # if we have class fixture failures, we're not going to bother171 # running tests, but we need to generate bogus results for them all172 # and mark them as failed.173 self.__run_test_methods(class_fixture_failures)174 self._stage = self.STAGE_CLASS_TEARDOWN175 # class fixture failures count towards our total176 self.failure_count += len(class_fixture_failures)177 # Once a test case completes we should trigger178 # EVENT_ON_COMPLETE_TEST_CASE event so that we can log/report test case179 # results.180 if not test_case_result.complete:181 test_case_result.end_in_success()182 self.fire_event(self.EVENT_ON_COMPLETE_TEST_CASE, test_case_result)183 @classmethod184 def in_suite(cls, method, suite_name):185 """Return a bool denoting whether the given method is in the given suite."""186 return suite_name in getattr(method, '_suites', set())187 def suites(self, method=None):188 """Returns the suites associated with this test case and, optionally, the given method."""189 suites = set(getattr(self, '_suites', []))190 if method is not None:191 suites |= getattr(method, '_suites', set())192 return suites193 def results(self):194 """Available after calling `self.run()`."""195 if self._stage != self.STAGE_CLASS_TEARDOWN:196 raise RuntimeError('results() called before tests have executed')197 return list(self.__all_test_results)198 def method_excluded(self, method):199 """Given this TestCase's included/excluded suites, is this test method excluded?200 Returns a set of the excluded suites that the argument method is in, or an empty201 suite if none.202 """203 method_suites = set(getattr(method, '_suites', set()))204 return (self.__suites_exclude & method_suites)205 def __run_test_methods(self, class_fixture_failures):206 """Run this class's setup fixtures / test methods / teardown fixtures.207 These are run in the obvious order - setup and teardown go before and after,208 respectively, every test method. If there was a failure in the class_setup209 phase, no method-level fixtures or test methods will be run, and we'll eventually210 skip all the way to the class_teardown phase. If a given test method is marked211 as disabled, neither it nor its fixtures will be run. If there is an exception212 during the setup phase, the test method will not be run and execution213 will continue with the teardown phase.214 """215 for test_method in self.runnable_test_methods():216 result = TestResult(test_method)217 # Sometimes, test cases want to take further action based on218 # results, e.g. further clean-up or reporting if a test method219 # fails. (Yelp's Selenium test cases do this.) If you need to...

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