Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Last-minute panic tweaks.

  • Loading branch information...
commit d2e1390dd6a70aa7c6f225f519a2d8a1ac6894ac 1 parent 33dceb0
@carljm authored
View
10 levels/10_intro.md
@@ -9,7 +9,7 @@
.notes Go see the video of Gary's "Fast test, slow test" talk.
-<!SLIDE>
+<!SLIDE incremental>
# Unit tests #
@@ -20,12 +20,16 @@
* Help you structure your code better.
-<!SLIDE>
+<!SLIDE incremental>
# Integration tests #
* Test that the whole integrated system works; catch regressions.
-* Slow (just write a few, test the edge cases with unit tests).
+* Slow.
+
+* Less useful failures.
+
+* Write fewer.
.notes Summary: both are useful, write more unit tests.
View
27 models/10_dbsetup.md
@@ -3,9 +3,34 @@
## The database makes your tests slow. ##
* Try to write tests that don't hit it at all.
+* Separate db-independent model-layer functionality from db-dependent
+ functionality.
* But you'll still have a lot of tests that do.
+* Mocking the database usually isn't worth it.
-.notes The DB is pretty core to most web apps; mocking it makes your tests fast, but I don't think it's worth it.
+<!SLIDE>
+
+ @@@ python
+ class Thing(models.Model):
+ def frobnicate(self):
+ """Frobnicate and save the thing."""
+ # ... do something complicated
+ self.save()
+
+
+<!SLIDE>
+
+ @@@ python
+ def frobnicate_thing(thing):
+ # ... do something complicated
+ return thing
+
+
+ class Thing(models.Model):
+ def frobnicate(self):
+ """Frobnicate and save the thing."""
+ frobnicate_thing(self)
+ self.save()
<!SLIDE incremental>
View
8 title/10_plan.md
@@ -1,8 +0,0 @@
-<!SLIDE>
-
-# The plan #
-
-* Test discovery
-* Testing models
-* Testing views
-* Testing docs
2  views/50_guideline.md
@@ -4,6 +4,8 @@
* Write system tests for your views.
+* Write Selenium tests for Ajax, other JS/server interactions.
+
* Write unit tests for everything else (not strict).
* Test each case (code branch) where it occurs.
View
2  whichtests/30_problem.md
@@ -1,6 +1,6 @@
<!SLIDE incremental>
-# Django's test runner #
+# Django's test discovery #
* Wastes my time with tests I don't care about.
* Requires app tests to be in a single module (resulting in boilerplate
View
4 whichtests/40_solution.md
@@ -3,7 +3,7 @@
# It's easy to change. #
* unittest2 discovery
-* `TEST_RUNNER`
+* `TEST_RUNNER` setting
.notes The hipsters like nose or py.test, but unittest2 gets the job done.
@@ -48,7 +48,7 @@
# \o/ #
-* Discovers tests wherever you put them.
+* Discovers tests wherever you want them.
* Doesn't run tests from external apps by default.
* Flexible specification of specific tests to run: Python dotted path to test
module, not Django app label.
Please sign in to comment.
Something went wrong with that request. Please try again.