I'm in the process of writing tests for my Django website and I'd like to understand what's the actually difference (and what is better, more suitable) way of testing views.py files.
From documentation there are two ways:
- let's call it simple - described here https://docs.djangoproject.com/en/3.0/topics/testing/tools/
- advanced testing - https://docs.djangoproject.com/en/3.0/topics/testing/advanced/
Approach #1 is working ok and I can do e.g. request that will return everything I'll see on the page. Approach #2 appears to be more precise in the way I can ask for exact function within class-based view. Also I see this approach dominating in Django's internal tests.
Which way is preferred when it comes to Django testing?
Aucun commentaire:
Enregistrer un commentaire