Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

160
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda