Command line tool

htmltest passing

I work with a number of static websites with continuous deployment pipelines. A lot of the pages on these sites are assembled automatically, and occasionally an edit to one piece of content may break things in hard to spot ways. To avoid pushing broken output to production we run tests on that output, these tests must pass for the site to deploy. I’m looking out for:

  • Broken / invalid / insecure links (anchors, links, scripts and more).
  • Images with missing alt tags.
  • Assorted bits that should be in the <head> actually are.
  • Lots of other checks on other tags and attributes.

htmltest was developed as an alternative to the popular Ruby gem html-proofer and most notably addresses the latter’s performance issues when used with large sites. Written in Go, htmltest takes advantage of the compiled languages speed along with a testing algorithm that caches external results and avoids repeating reading of local files.

Version 0.2.0 is in use a large site I maintain, running on just over two thousand pages takes htmltest eleven seconds, htmlproofer took over three minutes.

Work is currently being done to allow document testing to take place in parallel. An alpha implementation is currently functional, albeit with some bugs.