Reader small image

You're reading from  Hands-On Software Engineering with Golang

Product typeBook
Published inJan 2020
Reading LevelIntermediate
PublisherPackt
ISBN-139781838554491
Edition1st Edition
Languages
Right arrow
Author (1)
Achilleas Anagnostopoulos
Achilleas Anagnostopoulos
author image
Achilleas Anagnostopoulos

Achilleas Anagnostopoulos has been writing code in a multitude of programming languages since the mid 90s. His main interest lies in building scalable, microservice-based distributed systems where components are interconnected via gRPC or message queues. Achilleas has over 4 years of experience building production-grade systems using Go and occasionally enjoys pushing the language to its limits through his experimental gopher-os project: a 64-bit kernel written entirely in Go. He is currently a member of the Juju team at Canonical, contributing to one of the largest open source Go code bases in existence.
Read more about Achilleas Anagnostopoulos

Right arrow

Unit testing

By definition, a unit is the smallest possible bit of code that we can test. In the context of Go programming, this would typically be a single function. However, according to the SOLID design principles that we explored in the previous chapters, each Go package could also be construed as an independent unit and tested as such.

The term unit testing refers to the process of testing each unit of an application in isolation to verify that its behavior conforms to a particular set of specifications.

In this section, we will dive into the different methodologies of unit testing at our disposal (black- versus white-box testing). We will also examine strategies for making our code easier to unit test and cover the built-in Go testing packages, as well as third-party packages, that are designed to make writing tests more streamlined.

...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Hands-On Software Engineering with Golang
Published in: Jan 2020Publisher: PacktISBN-13: 9781838554491

Author (1)

author image
Achilleas Anagnostopoulos

Achilleas Anagnostopoulos has been writing code in a multitude of programming languages since the mid 90s. His main interest lies in building scalable, microservice-based distributed systems where components are interconnected via gRPC or message queues. Achilleas has over 4 years of experience building production-grade systems using Go and occasionally enjoys pushing the language to its limits through his experimental gopher-os project: a 64-bit kernel written entirely in Go. He is currently a member of the Juju team at Canonical, contributing to one of the largest open source Go code bases in existence.
Read more about Achilleas Anagnostopoulos