LibreOffice 25.2 Help
The UnitTest service provides a framework for automating unit tests using the Basic language, including the ability to:
Aggregate test cases into test suites and unit tests.
Share setup and shutdown code among test cases.
Report test results using the Console.
Both the unit tests and the code to be tested must be written in Basic. The code being tested may call functions written in other languages.
The UnitTest service is not available for Python scripts.
A test case is the individual unit of testing. It checks for a specific response to a particular set of inputs.
In the UnitTest service, a test case is represented by a single Basic Sub whose name starts with a common prefix (the default is "Test_").
The test case fails if one of the AssertX methods returns False.
A test suite is a collection of test cases that should be executed together.
All test cases of a test suite are stored in a single Basic module.
A test suite may implement the SetUp and TearDown methods to prepare for test cases in its module.
A full unit test consists of a set of test suites in the same Basic library.
Before using the UnitTest service the ScriptForge library needs to be loaded or imported: