Bird
0
0

After adding a new test method in your Django TestCase, it does not run when executing 'manage.py test'. What is the most probable reason?

medium📝 Debug Q6 of 15
Django - Testing Django Applications
After adding a new test method in your Django TestCase, it does not run when executing 'manage.py test'. What is the most probable reason?
AThe Django server is not running
BThe test class does not inherit from models.Model
CThe test method name does not start with 'test_'
DThe database migrations are incomplete
Step-by-Step Solution
Solution:
  1. Step 1: Recall Django test discovery rules

    Django runs methods starting with 'test_' inside TestCase subclasses.
  2. Step 2: Analyze options

    The test method name does not start with 'test_' correctly identifies the naming convention required for tests to run.
  3. Final Answer:

    The test method name does not start with 'test_' -> Option C
  4. Quick Check:

    Test methods must start with 'test_' [OK]
Quick Trick: Test methods must be named starting with 'test_' [OK]
Common Mistakes:
MISTAKES
  • Forgetting the 'test_' prefix
  • Confusing model inheritance with test inheritance
  • Assuming server must be running for tests
  • Thinking migrations affect test discovery

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes