basysKom Toolbox

12 – Make use of unit tests

Make use of unit tests

Goals

Improve code quality and enable change

Description

Manual testing is boring, error-prone, time consuming and therefore expensive. This leads to bad test coverage, bugs slipping in and people growing reluctant to changing things that already work (or seem to work). Unit tests allow to establish trust towards a code base and enable fearless change. They can also be used to guide the creation of new APIs by providing a test bed. Automated unit tests can be nicely combined with dynamic testing tools such as Valgrind or the AddressSanitizer.

Environment

All

Platform

All

Implementation effort

Very low for green field projects. Establishing unit tests for an existing legacy code base can be a struggle.

Applicability

Caveats

  • Don’t create tests that only run on a special target device (these are integration tests).

See also

Implementation hints

  • Don’t get to orthodox about what constitutes a unit, but avoid to create tests that are actually integration tests.
  • Make sure your tests execute quickly so developers will actually run them as part of their build process.
  • Make sure individual tests are self-contained and do not rely on the post conditions of tests being executed earlier.
About the Toolbox

The basysKom Toolbox is a state-of-the-art collection of best practices in agile management and software development and a valuable tool for every kickoff meeting.

These cards can be used during a project kickoff in order to select best fitting good practices from the very start of your project, but also as a reminder during the course of a project implementation. Every card holds a QR code with additional information related to the specific tool, the tools’ applicability, known constraints and additional tips on how to implement it in a project setup.

You can provide us feedback on GitHub.

Toolbox

basysKom Newsletter

We collect only the data you enter in this form (no IP address or information that can be derived from it). The collected data is only used in order to send you our regular newsletters, from which you can unsubscribe at any point using the link at the bottom of each newsletter. We will retain this information until you ask us to delete it permanently. For more information about our privacy policy, read Privacy Policy