Report scenarios with unimplemented steps in cucumber json output - #833
Open
LucasLeao18 wants to merge 1 commit into
Open
LucasLeao18 wants to merge 1 commit into
LucasLeao18 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problema
Quando o primeiro step de um cenário não tem definição implementada, o relatório cucumber JSON sai como
[]: o cenário é silenciosamente descartado. Se outro step (segundo em diante) estiver faltando, o cenário aparece normalmente. Reprodução mínima no corpo da issue #721.Causa raiz:
StepDefinitionNotFoundErroré levantado em_execute_scenarioantes de qualquerpytest_bdd_before_step, então nenhum step report é registrado. O hookpytest_bdd_step_func_lookup_errordisparava sem nenhum handler de reporting, eLogBDDCucumberJSON.pytest_runtest_logreportignora cenários comstepsvazio.Solução
reporting.step_func_lookup_error(): registra o step sem definição como falhado e finaliza o restante viaScenarioReport.fail(), o mesmo tratamento de qualquer outra falha no meio do cenário.plugin.py: liga o hookpytest_bdd_step_func_lookup_errora esse handler (espelhandopytest_bdd_step_error).Com isso, o cenário aparece no JSON com o step faltante marcado como
failed(incluindo a mensagemStep definition is not found), independente de qual step esteja faltando.Validação
test_missing_first_step_definitionemtests/feature/test_cucumber_json.py(falha antes do fix com[], passa depois).tests/feature/test_cucumber_json.py: 4 passed.test_feature_base_dir,test_generate,test_migrate) também falham num checkout limpo neste ambiente Windows, sem relação com a mudança.ruff check,ruff format --checkemypylimpos nos arquivos alterados.Referência
Fixes #721