office-gobmx/wizards/Package_sfunittests.mk

31 lines
1.2 KiB
Makefile
Raw Normal View History

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-03 10:51:57 -05:00
# -*- 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/.
#
# This file incorporates work covered by the following license notice:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
$(eval $(call gb_Package_Package,wizards_basicsrvsfunittests,$(SRCDIR)/wizards/source/sfunittests))
$(eval $(call gb_Package_add_files,wizards_basicsrvsfunittests,$(LIBO_SHARE_FOLDER)/basic/SFUnitTests,\
SF_Register.xba \
SF_UnitTest.xba \
__License.xba \
dialog.xlb \
script.xlb \
))
# vim: set noet sw=4 ts=4: