6

I'd like to make sure that my Django test suite covers all URLs listed in my URL configuration. Is there a way to compare the list in the URL configuration to a list of URLs that have been hit during a test suite?

2 Answers 2

2

I was able to come up with a solution by defining a custom test suite runner that records the URLs being accessed and compares it to the list of configured URLs.

Here's the code: http://djangosnippets.org/snippets/2694/

Sign up to request clarification or add additional context in comments.

Comments

0

You should use django-coverage

http://pypi.python.org/pypi/django-coverage

It runs your test suite, and outputs nice html reports of what code is covered. I think this will be a more fail-safe and robust way to make sure that all your urls are covered.

1 Comment

I am already using this, but I also want URL coverage, since you could cover all code paths without covering all URLs.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.