Bummer! You have been redirected as the page you requested could not be found.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Most of the power of testing in Python comes from the `unittest` framework and it's `TestCase` class. Let's look at starting a `TestCase` and writing a couple of simple tests.
New Terms
unittest - Python's library for writing tests
TestCase - A collection of tests
Running tests
Command line
python -m unittest tests.py
In a script
unittest.main()
Remember, all tests in a TestCase
have to start with the word test_
to be run. You can have methods that don't start with test_
for other purposes if you need them.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Adrian Diaz
3,500 Points1 Answer
-
PLUS
Nitin Chauhan
Courses Plus Student 277 Points1 Answer
-
Nathan Brenner
35,844 Points1 Answer
-
James N
17,864 Points[RESOLVED] REALLY LARGE TRACEBACK! NameError: name 'TestCase' is not defined
Posted by James NJames N
17,864 Points2 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up