Performance: Factory Boy for test data
MEDIUM IMPACT
This affects test suite execution speed and memory usage during automated testing.
import factory class UserFactory(factory.django.DjangoModelFactory): class Meta: model = User username = factory.Faker('user_name') email = factory.Faker('email') def test_user_creation(): user = UserFactory() assert user.username is not None
def test_user_creation(): user = User.objects.create(username='testuser', email='test@example.com') assert user.username == 'testuser'
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Direct model creation in tests | N/A | N/A | N/A | [X] Bad |
| Using Factory Boy for test data | N/A | N/A | N/A | [OK] Good |