Development/Unit Tests

From The Document Foundation Wiki
Jump to: navigation, search

Preamble

This page is meant to give an overview of unit tests for LibreOffice. If you provide a patch on a lib, please try to provide corresponding unit tests. They'll allow a better understanding on how to use your new features or about what has been corrected (and will avoid regressions).

Note that even non-developers could help to improve some unit tests.

Motivation

See e.g. Kohei's talk for motivation. Quoting slide 25 here:

  • One unit test is worth 20 future bug fixes.
  • A bug fix does not finish until you write a test.
  • Writing unit test is courtesy for your fellow developers.
  • We really don’t have a choice.

Test frameworks

It is possible to write unit tests for LibreOffice using one of the following test frameworks:

Areas with "No fix without a unit test" rule

Several areas in the LibreOffice code require a unit test to be associated with every fix that goes into the area. Please talk to the responsible person (in brackets below), or to the general development mailing list if you have trouble writing an unit test. Also these areas would benefit most from more test coverage in general. So you are invited to provide more test coverage for these areas even if you are not changing behaviour.

Areas that require a unit test with every fix:

  • chart2 [Markus Mohrhard - moggi on IRC]
  • Writer import and export filters (documentation) [Miklos Vajna - vmiklos on IRC]