Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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.

For unit testing, we use the Go test framework directly (testing.T and TestXXX functions in xx_test.go files; sometimes also Example_xxx functions)

  • 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 dev testlogic)

  • 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.

For integration testing, we use various testing frameworks.

  • To exercise user-facing automatable functionality, using standard SQL client drivers, we use the roachtest framework.

    • Often in combination with the workload utility.

    • Also see Large scale testing.

  • To exercise user-facing interactive functionality, we have two test approaches:

    • To exercise interactions in a text terminal, we use the TCL interactive test suite (pkg/cli/interactive_tests)

    • To exercise interactions via a web browser, we use a standard javascript interactive test package (somewhere in pkg/ui)

  • To exercise non-standard SQL drivers and certain system libraries, we use:

    • The acceptance test framework (pkg/acceptance), which imports a Docker image containing many non-standard libraries and client drivers.

    • The Examples-ORMs test suite in CI.

  • No labels