Webinar
Smarty

Testing in Go by Example: Part 6

Smarty header pin graphic
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 icon
Subscribe Now
Read our recent posts
EigenRisk® adds Smarty’s location intelligence resources to its global CAT risk management platform
Arrow Icon
We're happy to announce a recent partnership with EigenRisk, an insurance technology firm. Below, you will find the announcement they published on their site:ANN ARBOR, MI, December 05, 2024—EigenRisk®, a leading provider of catastrophe risk management solutions, today announced a new agreement with Smarty, a preeminent provider of address data solutions. The agreement will make Smarty’s address location intelligence and geocoding resources available through the EigenPrism® catastrophe risk management platform.
Unlocking better real estate decisions with property data
Arrow Icon
Property data refers to the long and varied list of attributes that characterize or describe real estate assets. A properly configured bulk property data solution can help real estate pros form a reliable and highly detailed picture of an asset, providing vital insights about a property's location, structural features, and financial status long before stepping foot on the premises. Ready to experience supercharged property analytics with Smarty? Click here to try US Property Data live. Otherwise, keep reading as we dig into some real estate property data analytics use cases.
Computer Security Day
Arrow Icon
Here is a day to consider protecting sensitive data, whether it's names, addresses, social security numbers, telephone numbers, email addresses, driver's license numbers, passport numbers, financial data, or biometric records! Today's the day to double-check your systems and ensure accurate information management. It’s Computer Security Day, baby! 2-factor authentication? Check. Fingerprint and facial recognition? Check. Passwords over 15 characters long with alternating capital and lowercase letters, symbols, and numbers? Check!Your IT team is metaphorically making you double-pull on that yellow tab to ensure you’re strapped in securely.