enkessler / cuke_linter

A linting tool for Cucumber
MIT License
32 stars 8 forks source link

Linter does not validate scenarios with examples #26

Open T00595 opened 1 year ago

T00595 commented 1 year ago

Hello, today we are having a recurring problem where it happens that sometinmes our QAs create Scenarios with examples and not Scnarios Schemes in the gherkin code, with this it generates some problems such as missing executions due to the schemes not being considered, in this case we wanted to that the linter validated if a scenario had examples it would be barred so that it clould be change to the scenario scheme.

bad example:

@#charlan_bettiol @%validar Scenario: Validar campos Dado realizar o login E clicar no mercado Quando adicionar "1" produto "teste" ao E inserir "1233" para calcular o frete E clicar em comprar E validar os "" de cadastro do endereco Então verificar se esta ok Exemplos: | campos | | nome | | tipo | | numero |

good example: @#charlan_bettiol @%validar Scenario outline: Validar campos Dado realizar o login E clicar no mercado Quando adicionar "1" produto "teste" ao E inserir "1233" para calcular o frete E clicar em comprar E validar os "" de cadastro do endereco Então verificar se esta ok Exemplos: | campos | | nome | | tipo | | numero |

enkessler commented 1 year ago

I tried a couple likely Gherkin dialects but couldn't get your samples to parse, in order to see how they run. I think that this kind of feature is what you are describing

Feature:

@#charlan_bettiol
@%validar
Scenario: Validar campos
  * a step
Examples:
  | campos |
  | nome   |
  | tipo   |
  | numero |

@#charlan_bettiol
@%validar
Scenario Outline: Validar campos
  * a step
Examples:
  | campos |
  | nome   |
  | tipo   |
  | numero |

but I am not seeing the behavior that you are describing. Cucumber treats the scenarios as outlines whether they use Scenario or Scenario Outline. The factor that it keys off of is the presence of an example table. Running this feature will result in 6 test executions because an Examples is on both of the scenarios.

Are you running a less recent version of Cucumber that treats these two scenarios differently?

T00595 commented 1 year ago

I use cucumber 7.1 but for execution I use the gem parallel_cucumber

T00595 commented 1 year ago

Tentei alguns dialetos prováveis ​​do Gherkin, mas não consegui fazer com que suas amostras fossem analisadas para ver como elas funcionam. Eu acho que esse tipo de recurso é o que você está descrevendo

Feature:

@#charlan_bettiol
@%validar
Scenario: Validar campos
  * a step
Examples:
  | campos |
  | nome   |
  | tipo   |
  | numero |

@#charlan_bettiol
@%validar
Scenario Outline: Validar campos
  * a step
Examples:
  | campos |
  | nome   |
  | tipo   |
  | numero |

mas não estou vendo o comportamento que você está descrevendo. Cucumber trata os cenários como contornos, quer usem Scenarioou Scenario Outline. O fator que aciona é a presença de uma tabela de exemplo. A execução desse recurso resultará em 6 execuções de teste porque um Examplesestá em ambos os cenários.

Você está executando uma versão menos recente do Cucumber que trata esses dois cenários de maneira diferente?

Utilizo o pepino 7.1 mas para execução utilizo a gem parallel_cucumber