Search⌘ K
AI Features

Run the Test

Explore how to run tests as part of the test-driven development cycle in Django. Learn to execute all project tests, tests for a specific app, individual test cases, or single test methods. This lesson helps you verify that tests fail initially and target the correct features before coding begins.

The second step involved in the TDD process is to run the tests. These tests must be the actual tests we write in step one of the test-driven development process because those tests must fail. After all, the feature hasn’t been built. In addition, it’s also important that the tests we run are properly testing what’s meant to be tested—a new feature yet to be implemented. Therefore, in this step, it’s recommended that we don’t run old tests that have been written earlier. This will come later when we want to make all tests pass.

How does it work?

Recall those sample tests we saw in the previous lesson. Please bear in mind that they’re only for illustration purposes. A more practical example is shown in the next chapter when we start to build the project for this course.

There are four sample tests: ...