I'm writing unit tests for my Django application. However, I don't know how to test the HTML output of a view.
Sometimes I might want to check if a specific element contains certain value, or how many of those elements are displayed, or things like that. How can I do such tests?
I would like a solution that uses unittest
and django's own django.test
.
I know I can use Selenium or Pyccuracy (which uses Selenium), but Selenium tests are quite slow because of the huge overhead of launching a browser. Also, unit tests work out-of-the-box with django-coverage package.