A Problem and Spiking to Learn

First we’ll take on a small problem with significant dependencies in it. We’ll create an HTML page with a "Locate Me" button. When the user clicks that button, a JavaScript function will invoke the geolocation API to get the user’s location. If it succeeds, then the program will display the location on Google Maps. If the request fails, an error message will be displayed on the HTML page.

That’s not a hard problem, but thinking through automated tests for this program may not be easy. Setting the mind on writing tests may lead to many confusing questions: where to start, what to test, what do we actually code… When the path is not clear, rely on spiking.

Let’s create a quick spike to gain insight into ...

Get Test-Driving JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.