Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

154
Vistas
cucumber stop execution based on Examples parameter

Is it possible to stop running steps after a condition is met? For a web app with multiple pages, I have scenarios that check all pages, and some stop in the middle.

I would like to use the same feature file and not duplicate the scenario outline, currently, the feature looks like this:

Scenario Outline: TC__<tcNr>__<endScenarioPage>

    # dataPrep step
    Given step for data prep <params1> <params2>

    # page_1
    Given step 1 <params1>
    Given step 2 <params2>

    # page_2
    Then step 1 <params3>
    Then step 2 <params4> <endScenarioPage>

    # page_3
    Then step 1 <params5> 
    Then step 2 <params6>

    # page_4
    Then step 1 <params7>
    Then step 2 <params8>

    @set1
    Examples:
        | tcNr    | params1 | params2 | endScenarioPage |
        | "SCN01" | " ..."  | " ..."  | "page2"         |
        | "SCN02" | " ..."  | " ..."  | "page4"         |
        | "SCN03" | " ..."  | " ..."  | "page2"         |

    @set2
    Examples:
        | tcNr    | params1 | params2 | endScenarioPage |
        | "SCN01" | " ..."  | " ..."  | "page2"         |
        | "SCN02" | " ..."  | " ..."  | "page2"         |
        | "SCN03" | " ..."  | " ..."  | "page4"         |

so for scenarios "SCN01" and "SCN03" from @set1 tests should be stopped on page2.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Scenario Outlines are just a complicated way of writing several individual scenarios in one block of feature code. You would make things much simpler and clearer by not using on outline and just writing individual scenarios. Then your problem of stopping would just disappear, as that scenario would just not have that step

Scenario: 4 page example
  Given x
  Then 1
  And 2
  And 3
  And 4

Scenario: 2 page example
  Given y
  Then 1
  And 2

Its much better to write many simple scenarios (even if they have lots of repitition than one complex scenario outline (like you have in your question).

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda