Search⌘ K
AI Features

What Are Tests?

Explore the fundamentals of software testing in this lesson, including the purpose of tests, types such as unit, integration, and end-to-end tests, and the concept of code coverage. Understand how tests help detect bugs, improve code quality, and support test-driven development practices with Go. Learn to classify code statements and measure coverage to write dependable software.

Overview

Software testing is a fundamental part of software development. Its primary purpose is to check whether our software is behaving in the way we expect it to. Below are some of the reasons we should write tests in our program:

  • Detect bugs: We write tests to detect defects, bugs, regressions, and more.

  • Customer satisfaction: If we fix bugs before releasing the project to the customer, they’ll be more satisfied with our work.

  • Documentation: Tests offer a different way of documenting the usage of our code.

  • Efficiency: We improve our efficiency as we get feedback in the early stage of development. Thus, we can pay extra attention to the most delicate features.

  • Improve knowledge: By writing tests, we also improve our general knowledge of the programming language.

  • Security: We can deliver a more secure program that is well tested against vulnerabilities.

  • Money: Bugs cost money, so the more bugs we fix, the more money will be saved.

History of tests

First, let’s clarify two terms that we will often see when dealing with tests: production code and test ...