0

I try to apply TDD in my project. I have this template:

<html>
  <head>
    <title>Selamat datang di Infoplace</title>
  </head>
  <body>
    <h1>Selamat datang di InfoPlace</h1>
    <a href="{% url 'registration_page' %}" id="registration_link">Daftar</a>
  </body>
</html>

I don't have url named 'registration_page' yet. When I open this page in browser, I got error NoReverseMatch, obviously. But how do I catch this error with a headless browser testing? Or at least display the stacktrace of NoReverseMatch in the test result.

pupil
  • 318
  • 2
  • 16

1 Answers1

0

It turns out I can use django's built-in TestCase & Client to catch this problem. All I have to do is create a test that request to the url/view that render this template. Than the NoReverseMatch error will be displayed.

pupil
  • 318
  • 2
  • 16