Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
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 upRelated 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