Test-Driving HTML templates

After a decade or more where Single-Page-Applications generated by JavaScript frameworks have become the norm, we see that server-side rendered HTML is becoming popular again, also thanks to the emergence of libraries such as HTMX or Turbo. Writing a rich web UI in a traditionally server-side language like Go is now not only possible, but a very attractive proposition.

LEVEL: Intermediate

Place
GoLab Discovery
Length
25 min
When
November 12th, 2024
15:30

Abstract

We then face the problem of how to write automated tests for the HTML parts of our applications. While the JavaScript world has evolved powerful and sophisticated ways to test the UI, ranging in size from unit-level to integration to end-to-end, in other languages we do not have such a richness of tools available.

It is certainly possible to test the UI indirectly through end-to-end tests, but those tests are slow and expensive. In this session we will see how to write fast, laser-focused unit tests on our HTML templates, to prevent subtle (or not-so-subtle) errors that can be overlooked by manual or end-to-end testing.

The technique is simple and fun, based on standard Go templates and with the help of the goquery library.

GoLab is a conference made by Develer.
Develer is a company based in Campi Bisenzio, near Florence. Our motto is : "Technology to give life to your products". We produce hardware and software to create exceptional products and to improve industrial processes and people's well being.
In Develer we have passion for the new technologies and we offer our clients effective solutions that are also efficient, simple and safe for the end users. We also believe in a friendly and welcoming environment where anybody can give their contribution. This passion and this vision are what we've been driven to organize our conference "made by developers for developers".


Subscribe to our newsletter

We hate spam just as much as you do, which is why we promise to only send you relevant communications. We respect your privacy and will never share your information with third parties.
©2024 GoLab | The international conference on Go in Florence-Design & devCantiere Creativo-Made withDatoCMS