Parallel tests
At the moment, we will get very little from doing the next step, but it is a great tool to have for much larger codebases. We're going to make these tests run in parallel!
This is actually incredibly simple to implement, but could definitely cause some problems if misused, so we will talk about that.
First, to see the differences between testing with Parallel
and without, let us first run go test -v
. (-v
is for verbose, to show the tests we are running.)
1
$ go test -v
2
=== RUN TestJSON
3
--- PASS: TestJSON (0.00s)
4
=== RUN TestGet
5
--- PASS: TestGet (0.00s)
6
PASS
See that it shows it ran TestJSON
and then it ran TestGet
. When we add the parallelism, it will show something different.
This page is a preview of Reliable Webservers with Go