EasyEnv
Engineering/Courses/Catalog/Go/Testing and Benchmarks
Go
BeginnerLesson 12 of 2040 min · hands-on

Testing and Benchmarks

Part of the Go course

You wrote a function, ran the program, saw the right answer, and moved on. A week later you change something nearby and the function quietly starts returning the wrong thing for negative numbers. Nobody notices for a month. This is the ordinary way software breaks, and it is not caused by bad programmers, it is caused by nobody re-checking the old things after changing a new one.

A test is that re-check written down once and performed by the machine. Its value is not proving your code works today, when you have just watched it work. Its value is that in six months you can change anything you like, run one command, and get a straight answer about what you broke. ...

Want to learn Go Testing and Benchmarks in a real environment?

Click below, get a fresh Linux box with Go ready to go, and work through Testing and Benchmarks hands-on with an AI tutor that knows your code.

Start this lessonTesting and Benchmarks

What you'll learn

  • Go test
  • Testing.T
  • Table-driven tests
  • T.Run subtests
  • Testing.B benchmarks
  • _test.go file naming
  • Test coverage

Read this lesson in your language

All lessons in this course

20 lessons
  1. 1Hello, Go25 min
  2. 2Variables and Types25 min
  3. 3Control Flow: if and for30 min
  4. 4Functions30 min
  5. 5Slices and Maps35 min
  6. 6Structs and Pointers35 min
  7. 7Methods and Interfaces35 min
  8. 8Error Handling35 min
  9. 9Modules and Project Structure35 min
  10. 10Tiny CLI Capstone40 min
  11. 11A Tour of the Standard Library40 min
  12. 12Testing and Benchmarks40 min
  13. 13Goroutines and Channels40 min
  14. 14Concurrency Patterns45 min
  15. 15Generics35 min
  16. 16HTTP Servers45 min
  17. 17Databases with database/sql45 min
  18. 18Performance and Profiling40 min
  19. 19Design Patterns in Go40 min
  20. 20Deployment and Production45 min

Explore other courses

Testing and Benchmarks - Go (English) | Engineering Courses