<a id="unit-testing"></a>

# Unit testing

* [Checker](https://documentation.ubuntu.com/juju/3.6/contributor/reference/testing/unit-testing/checker.md)
* [Unit test suite](https://documentation.ubuntu.com/juju/3.6/contributor/reference/testing/unit-testing/unit-test-suite.md)
* [Util suite](https://documentation.ubuntu.com/juju/3.6/contributor/reference/testing/unit-testing/util-suite.md)

> See also: [Write a unit test](https://documentation.ubuntu.com/juju/3.6/contributor/howto/write-a-unit-test.md#write-a-unit-test)

Unit testing `juju` currently involves the [`gocheck` package](https://labix.org/gocheck) and the `go test` CLI
command.

A typical unit testing package is placed alongside the code package that you want to test (in the same directory) and
consists of:

- A file `package_test.go`, which is the entrypoint to your unit testing.
- (OPTIONAL) A file `export_test.go`, which is used to access or modify some internal aspect of the package under test
  for the tests. Even though the file ends with `_test.go`, the package definition is the same as the normal source
  files. In this way, for the tests and only the tests, additional variables and functions can be defined for the
  package and used in the tests.
- Test files of the form `<code filename>_test.go`, which are collections of [unit test suites](https://documentation.ubuntu.com/juju/3.6/contributor/reference/testing/unit-testing/unit-test-suite.md#unit-test-suite).
