Django: Getting Started Transcripts
Chapter: Your First Django App
Lecture: Why test Django views?

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Automated testing has become an important part of good development practice. In the old days you threw your code over the fence to QA
0:07 crossed your fingers and that's a bad idea. Doesn't take long before you've got way too much code and not enough support from QA.
0:16 Modern development practices include a significant amount of time towards automated testing
0:20 It isn't uncommon for there to be about as much test code as actual code To help support this, Django has supplemented the Python unit test framework.
0:32 You can define tests at both the project and at the app level. Django provides you tools that allow you to mimic logging into a server,
0:42 visiting a view and verifying the response content. All of this is done without a browser. That's both good and bad.
0:53 It's good because it means you can test a whole bunch from the command line and without any outside tools.
0:59 It's bad because it doesn't actually validate your page. It just returns it. If you're writing something that includes javascript,
1:06 that javascript won't get exercised. When building a commercial application, you often combine Django unit tests with tools like selenium,
1:15 a record playback tool that operates inside of a browser. The Django unit test can test the bedrock of your software including page flow and business
1:23 logic, while Selenium or something like it can be used to test the presentation.


Talk Python's Mastodon Michael Kennedy's Mastodon