Chapter 18. Testing Recipes

18.0 Introduction

Software testing is the process of checking that the software does what it is supposed to do. It’s a critical part of software development. Software testing, like many types of testing activities in other fields, traditionally happens after development completes. It is mostly done by people (testers) who run through scenarios, called test cases, and verify the output with the expected results.

Testing happens at various stages of the software development lifecycle and even beyond that. At the lowest level of code, unit testing checks code in individual functions and software modules. Integration testing ensures that different modules work well together, and functional testing ensures the correctness of the output.

Unlike many other fields, software testing doesn’t necessarily need to be done after the programs have been written and neither does it always need to be done by humans. Software testing can and often is done through automated testing by writing test scripts that execute test cases.

In the test-driven development (TDD) methodology, automated test cases are written before any code is written and are repeatedly executed as the code is being written until the test cases succeed. In continuous testing, automated testing is done continuously throughout the software development lifecycle.

As you have realized, automated testing is pretty important in software development. In Go, testing is built into the language itself, and Go ...

Get Go Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.