Webinar
Smarty

Testing in Go by Example: Part 6

Even more about assertions.
Michael Whatcott
Michael Whatcott
 • 
September 25, 2017
Tags

For this installment of the Testing in Go series we'll be talking about a grouping of packages that facilitate general-purpose comparisons in various contexts. Since the most common context is testing it seemed like this series was the right place for the discussion.

We generally refer to these comparison functions as assertions (cue ominous background music and spooky sound effects). You may have already read the opinions found on the Golang FAQ related to assertions.

"Why does Go not have assertions?"

Go doesn't provide assertions. They are undeniably convenient, but our experience has been that programmers use them as a crutch to avoid thinking about proper error handling and reporting. Proper error handling means that servers continue operation after non-fatal errors instead of crashing...

"Where is my favorite helper function for testing?"

Go's standard testing package makes it easy to write unit tests, but it lacks features provided in other language's testing frameworks such as assertion functions. An earlier section of this document explained why Go doesn't have assertions, and the same arguments apply to the use of assert in tests.

In general, we agree that in many scenarios a single assertion failure shouldn't prevent a test from running. So, by default the assertion functions we use don't do that. Problem solved.

Subscribe to our blog!
Learn more about RSS feeds here.
rss feed iconSubscribe Now
Read our recent posts
Santa uses Smarty® 
Arrow Icon
HO HO HO! Merry Christmas, my dear friends,I’m taking a minute from my busy toy-making and list-checking (twice) schedule to write you a letter. I know, I know, usually, it’s you and your lovely children writing ME letters, but I’ve loved seeing your efforts to get on the nice list this year and want to give you a peek into how I make the magic happen. Because you made my heart feel warm even at the North Pole, I’m sharing the answer to my most asked question: "How do I deliver billions of gifts to people all over the world?” The magic behind my sleigh rides? Hint: it's not the reindeer… I use Smarty.
2025 and beyond: The future of CX
Arrow Icon
The customer experience (CX) landscape is changing faster than a squirrel on espresso 🐿️☕, driven by technological advancements, consumer expectation evolution, and the need for all things to become digital. Maybe you wanna keep up with the change. That’s great. Or even better, you want to get ahead of all the other guys. That’s where Smarty comes in. Looking at what the future of customer experience will be like in 2025 and beyond (supported by relevant statistics and insights from various studies we’ve collected), address autocomplete and verification play a bigger role than you might suspect.
Get more Black Friday & Cyber Monday sales using address data
Arrow Icon
Webinar recap: The holiday sales race is almost on, and if you’re not prepared with your checkout game plan, you might be left behind with a sea of cart abandonments and “Where’s my order?” calls. But fear not! We recently held a webinar with address data experts Caroline Roweton and Brent Francom to talk about the ways bad address data can WRECK your holliday sales bump. They covered 7 ways you can use address data tools like autocomplete and address verification to crush the competition faster than a Black Friday doorbuster crowd will crush your beautiful holiday displays.