Skip to Content
Hands-On Software Engineering with Golang
book

Hands-On Software Engineering with Golang

by Achilleas Anagnostopoulos
January 2020
Intermediate to advanced
640 pages
16h 56m
English
Packt Publishing
Content preview from Hands-On Software Engineering with Golang

Stubs and spies!

A stub is the simplest test pattern that we can use in our tests. Stubs typically implement a particular interface and don't contain any real logic; they just provide fixed answers to calls that are performed through the course of a test.

Let's dissect a short code example that illustrates how we can effectively use the concept of stubs for our tests. The Chapter04/captcha package implements the verification logic behind a CAPTCHA test.

CAPTCHA is a fairly straightforward way to determine whether a system is interacting with a human user or another program. This is achieved by displaying a random, often noisy, image containing a distorted sequence of letters and numbers and then prompting the user to type the text content ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Software Architecture with Golang

Hands-On Software Architecture with Golang

Jyotiswarup Raiturkar

Publisher Resources

ISBN: 9781838554491Supplemental Content