Bird
0
0

A pytest project has tests scattered without folders. You want to add a new feature test. What is the best fix?

medium📝 Debug Q7 of 15
PyTest - Test Organization
A pytest project has tests scattered without folders. You want to add a new feature test. What is the best fix?
ACreate a new folder for the feature and add tests there
BAdd all new tests to the existing big test file
CWrite tests without any folder or file structure
DSkip writing tests for the new feature
Step-by-Step Solution
Solution:
  1. Step 1: Identify best practice for scaling tests

    Organizing tests by feature in folders keeps tests clear and maintainable.
  2. Step 2: Evaluate options

    Adding to big files or skipping tests reduces clarity and coverage.
  3. Final Answer:

    Create a new folder for the feature and add tests there -> Option A
  4. Quick Check:

    Organize new tests by feature folder [OK]
Quick Trick: Use folders per feature to keep tests tidy [OK]
Common Mistakes:
MISTAKES
  • Adding tests to large unorganized files
  • Not writing tests for new features
  • Ignoring folder structure importance

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PyTest Quizzes