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
Improving insurance customers’ experiences in policy management
Arrow Icon
84% of customers say the experience a company provides is as important as its products or services, according to a Salesforce report. Over the past decade, the insurance market has become saturated with endless products and options. Buyers have adjusted and evolved in response to the buffet of insurance options, becoming more sophisticated and specific in what they need and want. To keep these sophisticated buyers at your insurance smorgasbord rather than the other guys’, it’s essential to understand their new and improved expectations.
Cleaning address databases with Smarty's lead developers
Arrow Icon
We recently brought together Kent Gividen and Bryan Amundson, two of Smarty's brilliant lead developers, to discuss the importance of maintaining a clean address database and how Smarty's innovative tools can make this process easier and more efficient. Question: "How should users prepare their address data before using Smarty's tools?"Kent: "To begin with, if you have a database that you're looking to clean the addresses for, you can dump those addresses into a CSV file. And there are several ways to make that easier to handle and process.
Marrying accelerated insurance claims with address data
Arrow Icon
Remember that phrase we all used in middle school, “Well if you love it so much, why don’t you marry it?” Well, we couldn’t agree more. Address data and insurance claims have been partners in an ever-evolving landscape of technology and property for years. Insurance claims rely on geocoding to find the exact location, and property data is used to assess the property's condition and attached amenities before losses. Efficiently deploying adjusters and accurately assessing damage is impossible without accurate address data.