Skip to main content

LAB: Writing Tests First

Writing code is what we do, and it's the fun part of being a programmer. Writing shopping cart code, however, might fall into that "boilerplate" category. There's just not much to figure out. Let's make Gemini do it.

We're at an interesting point in the process with this lab. It's tempting to have Gemini write the code for us straight away, and then write the tests to "prove" that it works.

On the other hand, writing the tests first allows us to refine them and to think through things prior to writing any code. Most importantly: it allows us to write the code to make the tests pass.

Either way, we'll see how we can have Gemini write things for us. Before we get going, be sure to commit your changes so we can step backwards if needed.

Updated on Nov 21, 2025