Any project usually needs a combination of multiple types of tests simultaneously: both unit and integration tests – the latter especially if there are user-facing features.
Unit testing Unit tests are valuable to ensure that a single component or function operates as designed, regardless of how it was integrated from other components.
unit testing, we use the Go test framework directly (
TestXXX functions in
xx_test.go files; sometimes also
Independent components can be exercised by instantiating them independently in a test.
Unit tests for SQL functionality can be exercised via the
SQL logic test framework (see pkg/sql/logictest and
Other unit tests that needs a functional SQL or KV layer can use
TestServer and TestCluster. Integration testing Integration tests are valuable to exercise a product journey as experienced by an end-user.
integration testing, we use various testing frameworks.
To exercise user-facing
automatable functionality, using standard SQL client drivers, we use the roachtest framework.
user-facing interactive functionality, we have two test approaches:
To exercise interactions in a
text terminal, we use the TCL interactive test suite (
To exercise interactions via a
To exercise non-
standard SQL drivers and certain system libraries, we use: