Martin Fowler
Follow
Test-Driving HTML Templates
When building a server-side rendered web application, it's valuable
to test the HTML that's generated through templates. While these can be
tested through end-to-end tests running in the browser, such tests are
slow and more work to maintain than unit tests. My colleague
Matteo Vaccari has written an article on how to use TDD
to test drive these templates using xunit-style tools which can be run
easily from the command line or as part of build scripts.In this first installment Matteo describes how such tests can check the
generated HTML for validity, with examples in Java and Go.