office-gobmx/desktop/CppunitTest_desktop_lib.mk
Jean-Pierre Ledure 14c7bc1c90 ScriptForge - New 'UnitTest' service for Basic
The "UnitTest" service is implemented as a new
Basic library called 'SFUnitTests'.

ScriptForge unit tests (SF_UnitTest class module)
======================
Class providing a framework to execute and check sets of unit tests.

The UnitTest unit testing framework was originally
inspired by unittest.py in Python
and has a similar flavor as major unit testing
frameworks in other languages.

It supports
- test automation
- sharing of setupand shutdown code
- aggregation of tests into collections.

Both the
- code describing the unit tests
- code to be tested
must be written exclusively in Basic
(the code might call functions written in other languages).
The code to be tested may be released as an extension.
It does not need to make use of ScriptForge services.

The test reporting device is the Console.

Definitions:
- Test Case: each test case is a Basic Sub.
- Test Suite: a collection of test cases stored in 1 Basic module.
- Unit test: a set of test suites stored in 1 library.

Two modes:
- the normal mode ("full mode"), using test suites and test cases
  The UnitTest service is passed as argument to each test case.
- the "simple mode" limited to the use of the Assert...() methods.

Service invocation examples:
- In full mode, the service creation is external to test cases
        Dim myUnitTest As Variant
        myUnitTest = CreateScriptService("UnitTest", ThisComponent, "Tests")
            '    Test code is in the library "Tests"
            '    located in the current document
- In simple mode, the service creation is internal to every test case
        Dim myUnitTest As Variant
        myUnitTest = CreateScriptService("UnitTest")
        With myUnitTest
            If Not .AssertTrue(...) Then ...
            '    ...
            .Dispose()
        End With

Error handling
To support the debugging of the tested code, the UnitTest service, in cases of
- assertion failure
- Basic run-time error in the tested code
- Basic run-time error in the testing code (the unit tests)
will comment the error location and description in a message box and in the console log,
providing every test case (in either mode) implements an error handler
containing at least a call to the ReportError() method.

Change-Id: I9d9b889b148f172cd868af455493c8c696d1e953
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135365
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-06-04 12:08:36 +02:00

93 lines
2.2 KiB
Makefile

# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#*************************************************************************
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#*************************************************************************
$(eval $(call gb_CppunitTest_CppunitTest,desktop_lib))
$(eval $(call gb_CppunitTest_add_exception_objects,desktop_lib, \
desktop/qa/desktop_lib/test_desktop_lib \
))
$(eval $(call gb_CppunitTest_use_libraries,desktop_lib, \
comphelper \
cppu \
cppuhelper \
i18nlangtag \
sal \
sc \
scfilt \
sfx \
sofficeapp \
subsequenttest \
sw \
test \
unotest \
utl \
tl \
vcl \
))
$(eval $(call gb_CppunitTest_use_externals,desktop_lib, \
boost_headers \
cairo \
))
ifeq ($(TLS),NSS)
$(eval $(call gb_CppunitTest_use_externals,desktop_lib,\
plc4 \
nss3 \
))
endif
$(eval $(call gb_CppunitTest_set_include,desktop_lib,\
-I$(SRCDIR)/desktop/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_sdk_api,desktop_lib))
$(eval $(call gb_CppunitTest_use_ure,desktop_lib))
$(eval $(call gb_CppunitTest_use_vcl,desktop_lib))
$(eval $(call gb_CppunitTest_use_rdb,desktop_lib,services))
$(eval $(call gb_CppunitTest_use_configuration,desktop_lib))
$(eval $(call gb_CppunitTest_use_more_fonts,desktop_lib))
$(eval $(call gb_CppunitTest_use_packages,desktop_lib, \
scripting_scriptbindinglib \
wizards_basicshare \
wizards_basicsrvaccess2base \
wizards_basicsrvdepot \
wizards_basicsrveuro \
wizards_basicsrvform \
wizards_basicsrvgimmicks \
wizards_basicsrvimport \
wizards_basicsrvscriptforge \
wizards_basicsrvsfdatabases \
wizards_basicsrvsfdialogs \
wizards_basicsrvsfdocuments \
wizards_basicsrvsfunittests \
wizards_basicsrvsfwidgets \
wizards_basicsrvtemplate \
wizards_basicsrvtools \
))
$(eval $(call gb_CppunitTest_use_uiconfigs,desktop_lib, \
cui \
modules/swriter \
))
$(eval $(call gb_CppunitTest_use_packages,desktop_lib, \
postprocess_images \
))
# vim: set noet sw=4 ts=4: