Best Python code snippet using yandex-tank
plugin.py
Source:plugin.py
...27 return self.counting28 def add_counting(self, obj):29 """ add criterion that activated """30 self.counting += [obj]31 def add_criterion_class(self, criterion_class):32 """ add new criterion class """33 self.custom_criterions += [criterion_class]34 def get_available_options(self):35 return ["autostop", "report_file"]36 def configure(self):37 aggregator = self.core.job.aggregator38 aggregator.add_result_listener(self)39 self._stop_report_path = os.path.join(40 self.core.artifacts_dir,41 self.get_option("report_file", 'autostop_report.txt'))42 self.add_criterion_class(cr.AvgTimeCriterion)43 self.add_criterion_class(cr.NetCodesCriterion)44 self.add_criterion_class(cr.HTTPCodesCriterion)45 self.add_criterion_class(cr.QuantileCriterion)46 self.add_criterion_class(cr.SteadyCumulativeQuantilesCriterion)47 self.add_criterion_class(cr.TimeLimitCriterion)48 self.add_criterion_class(cum_cr.TotalFracTimeCriterion)49 self.add_criterion_class(cum_cr.TotalHTTPCodesCriterion)50 self.add_criterion_class(cum_cr.TotalNetCodesCriterion)51 self.add_criterion_class(cum_cr.TotalNegativeHTTPCodesCriterion)52 self.add_criterion_class(cum_cr.TotalNegativeNetCodesCriterion)53 self.add_criterion_class(cum_cr.TotalHTTPTrendCriterion)54 self.add_criterion_class(cum_cr.QuantileOfSaturationCriterion)55 def prepare_test(self):56 criterions = self.get_option("autostop")57 for criterion_str in criterions:58 if not criterion_str:59 continue60 self.log.debug("Criterion string: %s", criterion_str)61 self._criterions[criterion_str] = self.__create_criterion(62 criterion_str)63 self.log.debug("Criterion objects: %s", self._criterions)64 try:65 console = self.core.get_plugin_of_type(ConsolePlugin)66 except Exception as ex: # pylint: disable=W070367 self.log.debug("Console not found: %s", ex)68 console = None...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!