コード例 #1
0
def before_feature(context: Context, feature: Feature):
    """Use autoretry feature which automatically retries failing scenarios."""
    if AUTO_RETRY:
        for scenario in feature.scenarios:
            patch_scenario_with_autoretry(
                scenario, max_attempts=AUTO_RETRY_MAX_ATTEMPTS
            )
コード例 #2
0
def before_feature(context, feature):
    '''
    Automatically wrap all scenarios tagged with 'autoretry' with a retry loop
    '''
    for scenario in feature.walk_scenarios():
        if "autoretry" in scenario.effective_tags:
            patch_scenario_with_autoretry(scenario, max_attempts=60)
コード例 #3
0
def before_feature(context: Context, feature: Feature):
    """Use autoretry feature of upcoming Behave 1.2.6 which automatically
    retries failing scenarios.
    Here's a PR for it https://github.com/behave/behave/pull/328
    """
    if AUTO_RETRY:
        for scenario in feature.scenarios:
            patch_scenario_with_autoretry(scenario, max_attempts=2)
コード例 #4
0
def before_feature(context: Context, feature: Feature):
    """Use auto-retry feature of upcoming Behave 1.2.6 which automatically
    retries failing scenarios.
    Here PR for it https://github.com/behave/behave/pull/328
    """
    if AUTO_RETRY:
        for scenario in feature.scenarios:
            patch_scenario_with_autoretry(scenario, max_attempts=2)
    if RESTART_BROWSER == "feature":
        start_driver_session(context, feature.name)
コード例 #5
0
def before_feature(context, feature):
  if active_tag_matcher.should_exclude_with(feature.tags):
    feature.skip(reason="DISABLED ACTIVE-TAG")

  for scenario in feature.walk_scenarios():
    retries = 0
    for tag in scenario.effective_tags:
      if tag.startswith('retries='):
        retries = int(tag.split('=')[1])

    if retries > 0:
      patch_scenario_with_autoretry(scenario, max_attempts=retries + 1)
コード例 #6
0
ファイル: environment.py プロジェクト: LUAgam/dble-test-suite
def before_feature(context, feature):
    logger.info('*' * 30)
    logger.info('Feature start: <{0}><{1}>'.format(feature.filename,feature.name))

    if "setup" in feature.tags:
        # delete the begin and end """
        for desc in feature.description[1:-1]:
            logger.info(desc)
            context.execute_steps(desc)

    for scenario in feature.scenarios:
        if "autoretry" in scenario.effective_tags:
            patch_scenario_with_autoretry(scenario, max_attempts=3)
コード例 #7
0
ファイル: basetest.py プロジェクト: longlylove/nzme-skynet
def before_feature(context, feature):
    """
    Executed at the beginning of every feature file
    :param context: behave.runner.Context
    :param feature: behave.model.Feature
    """
    context.driver = None
    context.picture_num = 0
    context.test_group = feature.name
    # Retry scenarios tagged with @autoretry
    for scenario in feature.scenarios:
        if "autoretry" in scenario.effective_tags:
            patch_scenario_with_autoretry(scenario, max_attempts=2)
コード例 #8
0
def before_feature(context, feature):
  for scenario in feature.walk_scenarios():
    retries = 0
    for tag in scenario.effective_tags:
      with value_tag(tag) as (tag, value):
        if tag == 'retry':
          retries = max(retries, 1)
        elif tag == 'retries':
          value = value or 0
          if value == 0: raise ValueError(f'{value} is not a valid number of retries')
          retries = max(retries, value)

    if retries > 0:
      patch_scenario_with_autoretry(scenario, max_attempts=retries + 1)
コード例 #9
0
def before_feature(ctx: Context, feature: Feature):
    """Setup run once before each feature.

    Args:
        ctx: The behave context object.
        feature: The behave feature object.
    """

    # Set the driver window size to mobile mode if tagged for feature
    set_mobile_mode(ctx, feature)

    # Find all scenarios w/setup and teardown tags and run them separately
    run_setup_teardown_tags(ctx, feature)

    # Make sure we auto-retry failed e2e scenarios up to the max attempts
    for scenario in feature.scenarios:
        if ctx.max_attempts:
            patch_scenario_with_autoretry(scenario, ctx.max_attempts)
コード例 #10
0
def before_feature(context, feature):
    for scenario in feature.scenarios:
        # If we're working on a scenario, then don't retry.
        if "wip" in scenario.effective_tags:
            continue
        elif "autoretry" in scenario.effective_tags:
            patch_scenario_with_autoretry(scenario, max_attempts=3)
        else:
            # Try at least once.
            # We might want to remove this, but leave it for now.
            # VSC can be flaky at times, here are a few examples:
            # 1. Line number isn't displayed in statusbar of VSC.
            # 2. Invoking `Close All Editors`, doesn't necessarily close everything.
            # 3. Other flaky issues.
            # 4. Download speeds are slow and LS doesn't get downloaded.
            # 5. Starting LS/Jedi is slow for some reason, and go-to-definition is slow/doesn't work.
            # 6. Similar intellisense is slow/doesn't work on both Jedi & LS.
            # We might want to log these as well, so we're aware of the flaky tests.
            patch_scenario_with_autoretry(scenario, max_attempts=2)
コード例 #11
0
def before_feature(context, feature):
    for scenario in feature.walk_scenarios():
        retries = None
        for tag in scenario.effective_tags:
            if tag == 'retry':
                r = 1
            else:
                r = tag.split('=', 1)
                if len(r) != 2 or r[0] != 'retries': continue

                r = r[1]
                try:
                    r = int(r)
                    if r == 0:
                        raise ValueError(tag)  # will be caught in the except
                except:
                    raise ValueError(f'{r} is not a valid number of retries')

            if retries is None or r > retries: retries = r

        if not retries is None:
            patch_scenario_with_autoretry(scenario, max_attempts=retries + 1)
コード例 #12
0
def before_feature(context, feature):
    # retry failures
    for scenario in feature.scenarios:
        # if "flaky" in scenario.effective_tags:
        patch_scenario_with_autoretry(scenario, max_attempts=2)
コード例 #13
0
def before_feature(context, feature):
    for scenario in feature.scenarios:
        if 'autoretry' in scenario.effective_tags:
            patch_scenario_with_autoretry(scenario, max_attempts=SCENARIO_RETRY)
コード例 #14
0
ファイル: environment.py プロジェクト: Thomish/Mycroft
def before_feature(context, feature):
    context.log.info('Starting tests for {}'.format(feature.name))
    for scenario in feature.scenarios:
        patch_scenario_with_autoretry(scenario, max_attempts=2)
コード例 #15
0
def before_feature(context: Context, feature: Feature):
    for scenario in feature.scenarios:
        patch_scenario_with_autoretry(scenario, max_attempts=3)
コード例 #16
0
def before_feature(context, feature):
    if context.variables["retry"]:
        for scenario in feature.walk_scenarios():
            patch_scenario_with_autoretry(scenario, max_attempts=2)