How to use make_tag_expression method in Behave

Best Python code snippet using behave

configuration.py

Source:configuration.py Github

copy

Full Screen

...528 self.color = False529 self.stop = True530 self.log_capture = False531 self.stdout_capture = False532 self.tag_expression = make_tag_expression(self._tags or self.default_tags)533 # -- BACKWARD-COMPATIBLE (BAD-NAMING STYLE; deprecating):534 self.tags = self.tag_expression535 if self.quiet:536 self.show_source = False537 self.show_snippets = False538 if self.exclude_re:539 self.exclude_re = re.compile(self.exclude_re)540 if self.include_re:541 self.include_re = re.compile(self.include_re)542 if self.name:543 # -- SELECT: Scenario-by-name, build regular expression.544 self.name_re = self.build_name_re(self.name)545 if self.stage is None: # pylint: disable=access-member-before-definition546 # -- USE ENVIRONMENT-VARIABLE, if stage is undefined....

Full Screen

Full Screen

behave_tag_expression_steps.py

Source:behave_tag_expression_steps.py Github

copy

Full Screen

...32# -----------------------------------------------------------------------------33# TYPE CONVERTERS:34# -----------------------------------------------------------------------------35def convert_tag_expression(text):36 return make_tag_expression(text.strip())37register_type(TagExpression=convert_tag_expression)38def convert_yesno(text):39 text = text.strip().lower()40 assert text in convert_yesno.choices41 return text in convert_yesno.true_choices42convert_yesno.choices = ("yes", "no", "true", "false")43convert_yesno.true_choices = ("yes", "true")44# -----------------------------------------------------------------------------45# STEP DEFINITIONS:46# -----------------------------------------------------------------------------47@given('the tag expression "{tag_expression:TagExpression}"')48def step_given_the_tag_expression(context, tag_expression):49 """50 Define a tag expression that is used later-on....

Full Screen

Full Screen

runner.py

Source:runner.py Github

copy

Full Screen

...45 my_env = os.environ.copy()46 my_env["TASK_ID"] = str(task_id)47 tag_expression = ''48 if tags is not None:49 tag_expression = make_tag_expression(tags)50 command = f'behave ./features -D device="{device}" {tag_expression} {formatter_args}'51 if is_web:52 command = f'{command} -D platform=web'53 print('Task {}: {}'.format(task_id, command))54 log_file = 'logs/{}.log'.format(device)55 with open(log_file, 'a+') as log:56 process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE,57 stderr=subprocess.PIPE, env=my_env)58 while True:59 output = process.stdout.readline().decode('utf-8')60 if output == '' and process.poll() is not None:61 break62 if output:63 log.write(output)64 log.flush()65 print('Task {} • {} • >> {}'.format(task_id, device, output.replace("\n", "")))66 rc = process.poll()67 log.write('Task {} • {} • >> Completed OK '.format(task_id, device))68 print('Task {} • {} • >> Completed OK '.format(task_id, device))69 return rc70def make_tag_expression(tags):71 tags_list = tags.split(',')72 tag_expression = ''73 for tag in tags_list:74 tag_expression += '--tags ' + tag + ' '75 return tag_expression76def run():77 parser = argparse.ArgumentParser()78 parser.add_argument('--d', help='Example: $ runner.py --d deviceName1,deviceName2 | Insert the devices.', required=True)79 parser.add_argument('--web', action='store_true', help='Example: True | Add this option IF it`s web automation. The code will run mobile native automation as default.')80 parser.add_argument('--tag', help='Example: $ runner.py --d deviceName --tag android,web | Insert tags to run the code accordingly to the tags added on test scenarios. If you want to not run the code on a specific tag, please add \'~\' before the tag.')81 args = parser.parse_args()82 devices = args.d83 devices = devices.split(',')84 web = args.web...

Full Screen

Full Screen

__init__.py

Source:__init__.py Github

copy

Full Screen

...16from .v1 import TagExpression17# -----------------------------------------------------------------------------18# FUNCTIONS:19# -----------------------------------------------------------------------------20def make_tag_expression(tag_expression_text):21 """Build a TagExpression object by parsing the tag-expression (as text).22 :param tag_expression_text: Tag expression text to parse (as string).23 :return: TagExpression object to use.24 """25 parse_tag_expression = select_tag_expression_parser(tag_expression_text)26 return parse_tag_expression(tag_expression_text)27def parse_tag_expression_v1(tag_expression_parts):28 """Parse old style tag-expressions and build a TagExpression object."""29 # -- HINT: DEPRECATING30 if isinstance(tag_expression_parts, six.string_types):31 tag_expression_parts = tag_expression_parts.split()32 # print("parse_tag_expression_v1: %s" % " ".join(tag_expression_parts))33 return TagExpression(tag_expression_parts)34def parse_tag_expression_v2(tag_expression_text):...

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