What kinds of testing exist?

What kinds of testing exist?#

There are many kinds of testing available to us - the three main ones are unit testing, integration testing, and end-to-end testing. The level of each that you employ can depend on the language you are using or the project you are writing, but generally you should expect more unit tests than integration tests, and more integration tests than end-to-end tests. It can be very useful to have all three.

Unit tests

  • operate on a single unit of code

  • usually test a single function

  • should ensure that your function works for a series of different and reasonable inputs

Integration tests

  • are the next step up

  • test the connection between components

  • are needed when you have separate sections of code that talk to and rely on each other

End-to-end tests

  • test the entirety of a system, starting with user input and going down through whatever storage mechanism might exist, and all the way back to the user again

  • can be quite slow, so it is not recommended that you write a lot of them

  • you need at least a couple to have confidence that your system, when it is all put together, works as you expect

 

This page is a preview of Reliable Webservers with Go

No discussions yet