Repository navigation
Divide os steps do pytest-bdd em um módulo por feature - #35
Merged
Merged
Conversation
Cada arquivo .feature passa a ter seu test_<feature>.py, com os steps exclusivos dele. Os steps usados por mais de uma feature ficam em steps/common_steps.py, registrado via pytest_plugins no conftest, e os dados de teste em steps/booking_data.py.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Resumo
steps/test_booking_steps.py(356 linhas) vira um módulo por feature, cada um com seuscenarios("../features/<feature>.feature")e só os steps dele:test_auth.py,test_create_booking.py,test_get_booking.py,test_update_booking.pyetest_delete_booking.pysteps/common_steps.py: steps usados por mais de uma feature (os três de token, "que existe um booking criado", 403 e 405). Fica registrado para todos os módulos viapytest_pluginsnoconftest.pyda raizsteps/booking_data.py:default_booking()ebooking_payload(), agora com nomes públicos porque são importados por mais de um módulo.featuretambém não mudamsteps/Os nomes dos testes no relatório mudam de
steps/test_booking_steps.py::...parasteps/test_<feature>.py::....Test plan
mypy .ruff check .ruff format --check .pytest: 53/53 testes passando (26 cenários BDD contra a API real e 27 unitários).feature: auth 2, create 6, get 3, update 12, delete 3