How to use __create_criterion method in yandex-tank

Best Python code snippet using yandex-tank

plugin.py

Source:plugin.py Github

copy

Full Screen

...59 for criterion_str in self.criterion_str.strip().split(")"):60 if not criterion_str:61 continue62 self.log.debug("Criterion string: %s", criterion_str)63 self._criterions[criterion_str + ')'] = self.__create_criterion(64 criterion_str)65 self.log.debug("Criterion objects: %s", self._criterions)66 try:67 console = self.core.get_plugin_of_type(ConsolePlugin)68 except Exception as ex: # pylint: disable=W070369 self.log.debug("Console not found: %s", ex)70 console = None71 if console:72 console.add_info_widget(AutostopWidget(self))73 def is_test_finished(self):74 if self.cause_criterion:75 self.log.info(76 "Autostop criterion requested test stop: %s",77 self.cause_criterion.explain())78 return self.cause_criterion.get_rc()79 else:80 return -181 def __create_criterion(self, criterion_str):82 """ instantiate criterion from config string """83 parsed = criterion_str.split("(")84 type_str = parsed[0].strip().lower()85 parsed[1] = parsed[1].split(")")[0].strip()86 for criterion_class in self.custom_criterions:87 if criterion_class.get_type_string() == type_str:88 return criterion_class(self, parsed[1])89 raise ValueError(90 "Unsupported autostop criterion type: %s" % criterion_str)91 def on_aggregated_data(self, data, stat):92 self.counting = []93 if not self.cause_criterion:94 for criterion_text, criterion in self._criterions.iteritems():95 if criterion.notify(data, stat):...

Full Screen

Full Screen

create_ad_group.py

Source:create_ad_group.py Github

copy

Full Screen

...34 )35 response = service.mutate_ad_groups(request=request)36 return response.results[0].resource_name37 # create ad-group criterion if required38 def __create_criterion(self, ad_group_resource):39 criterion_data = self.get_argument("criterion")40 # When criterion dont passed41 if criterion_data is None:42 return43 # Criterion can be array of criterions depending from ages44 for criterion in criterion_data:45 if "targeting" not in criterion and "keywords" is criterion:46 return47 # Targeting initiate48 if "targeting" in criterion:49 self.__create_ad_group_fields(50 ad_group_resource=ad_group_resource,51 criterion_data=criterion,52 creator_data=criterion["targeting"],53 creator_instance=AdGroupTargetingCriterionCreator(),54 )55 # Keywords initiate56 if "keywords" in criterion_data:57 self.__create_ad_group_fields(58 ad_group_resource=ad_group_resource,59 criterion_data=criterion,60 creator_data=criterion["keywords"],61 creator_instance=KeywordsCriterionCreator(),62 )63 # start execution64 @override_method65 def start_execution(self):66 ad_group_resource = self.__create_ad_group()67 self.__create_criterion(ad_group_resource)68 return {69 "id": self.get_id_from_resource("adGroups", ad_group_resource)...

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 yandex-tank 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