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>
This commit is contained in:
Jean-Pierre Ledure 2022-06-03 17:51:57 +02:00
parent cfb5148b56
commit 14c7bc1c90
18 changed files with 2171 additions and 4 deletions

View file

@ -1002,6 +1002,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ooo,\
wizards_basicsrvsfdatabases \
wizards_basicsrvsfdialogs \
wizards_basicsrvsfdocuments \
wizards_basicsrvsfunittests \
wizards_basicsrvsfwidgets \
wizards_basicsrvstandard \
wizards_basicsrvtemplate \

View file

@ -75,6 +75,7 @@ $(eval $(call gb_CppunitTest_use_packages,desktop_lib, \
wizards_basicsrvsfdatabases \
wizards_basicsrvsfdialogs \
wizards_basicsrvsfdocuments \
wizards_basicsrvsfunittests \
wizards_basicsrvsfwidgets \
wizards_basicsrvtemplate \
wizards_basicsrvtools \

View file

@ -285,6 +285,11 @@ Directory gid_Dir_Basic_SFDocuments
DosName = "SFDocuments";
End
Directory gid_Dir_Basic_SFUnitTests
ParentID = gid_Dir_Basic;
DosName = "SFUnitTests";
End
Directory gid_Dir_Basic_SFWidgets
ParentID = gid_Dir_Basic;
DosName = "SFWidgets";

View file

@ -33,6 +33,7 @@ $(eval $(call gb_Module_add_targets,wizards,\
Package_sfdatabases \
Package_sfdialogs \
Package_sfdocuments \
Package_sfunittests \
Package_sfwidgets \
Package_standard \
Package_template \

View file

@ -0,0 +1,30 @@
# -*- 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:

View file

@ -14,5 +14,6 @@
<library:library library:name="SFDatabases" xlink:href="$(INST)/@LIBO_SHARE_FOLDER@/basic/SFDatabases/dialog.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
<library:library library:name="SFDialogs" xlink:href="$(INST)/@LIBO_SHARE_FOLDER@/basic/SFDialogs/dialog.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
<library:library library:name="SFDocuments" xlink:href="$(INST)/@LIBO_SHARE_FOLDER@/basic/SFDocuments/dialog.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
<library:library library:name="SFUnitTests" xlink:href="$(INST)/@LIBO_SHARE_FOLDER@/basic/SFUnitTests/dialog.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
<library:library library:name="SFWidgets" xlink:href="$(INST)/@LIBO_SHARE_FOLDER@/basic/SFWidgets/dialog.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
</library:libraries>

View file

@ -14,5 +14,6 @@
<library:library library:name="SFDatabases" xlink:href="$(INST)/@LIBO_SHARE_FOLDER@/basic/SFDatabases/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
<library:library library:name="SFDialogs" xlink:href="$(INST)/@LIBO_SHARE_FOLDER@/basic/SFDialogs/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
<library:library library:name="SFDocuments" xlink:href="$(INST)/@LIBO_SHARE_FOLDER@/basic/SFDocuments/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
<library:library library:name="SFUnitTests" xlink:href="$(INST)/@LIBO_SHARE_FOLDER@/basic/SFUnitTests/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
<library:library library:name="SFWidgets" xlink:href="$(INST)/@LIBO_SHARE_FOLDER@/basic/SFWidgets/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
</library:libraries>

View file

@ -133,6 +133,10 @@ Const SQLSYNTAXERROR = &quot;SQLSYNTAXERROR&quot;
&apos; Python
Const PYTHONSHELLERROR = &quot;PYTHONSHELLERROR&quot;
&apos; SF_UnitTest
Const UNITTESTLIBRARYERROR = &quot;UNITTESTLIBRARYERROR&quot;
Const UNITTESTMETHODERROR = &quot;UNITTESTMETHODERROR&quot;
REM ============================================================= PRIVATE MEMBERS
&apos; User defined errors
@ -1025,6 +1029,12 @@ Try:
Case PYTHONSHELLERROR &apos; SF_Exception.PythonShell (Python only)
sMessage = sLocation _
&amp; &quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;PYTHONSHELL&quot;)
Case UNITTESTLIBRARYERROR &apos; SFUnitTests._NewUnitTest(LibraryName)
sMessage = sLocation _
&amp; &quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;UNITTESTLIBRARY&quot;, pvArgs(0))
Case UNITTESTMETHODERROR &apos; SFUnitTests.SF_UnitTest(Method)
sMessage = sLocation _
&amp; &quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;UNITTESTMETHOD&quot;, pvArgs(0))
Case Else
End Select
End With

View file

@ -1012,6 +1012,21 @@ Try:
, Comment := &quot;SF_Exception.PythonShell error message&quot; _
&amp; &quot;APSO: to leave unchanged&quot; _
)
&apos; SFUnitTests._NewUnitTest
.AddText( Context := &quot;UNITTESTLIBRARY&quot; _
, MsgId := &quot;The requested library could not be located.\n&quot; _
&amp; &quot;The UnitTest service has not been initialized.\n\n&quot; _
&amp; &quot;Library name : « %1 »&quot; _
, Comment := &quot;SFUnitTest could not locate the library gven as argument\n&quot; _
&amp; &quot;%1: The name of the library&quot; _
)
&apos; SFUnitTests.SF_UnitTest
.AddText( Context := &quot;UNITTESTMETHOD&quot; _
, MsgId := &quot;The method &apos;%1&apos; is unexpected in the current context.\n&quot; _
&amp; &quot;The UnitTest service cannot proceed further with the on-going test.&quot; _
, Comment := &quot;SFUnitTest finds a RunTest() call in a inappropriate location\n&quot; _
&amp; &quot;%1: The name of a method&quot; _
)
End With
End If

View file

@ -130,6 +130,7 @@ Try:
sLibrary = &quot;SFDocuments&quot;
Case &quot;dialog&quot;, &quot;dialogevent&quot; : sLibrary = &quot;SFDialogs&quot;
Case &quot;database&quot; : sLibrary = &quot;SFDatabases&quot;
Case &quot;unittest&quot; : sLibrary = &quot;SFUnitTests&quot;
Case &quot;menu&quot;, &quot;popupmenu&quot; : sLibrary = &quot;SFWidgets&quot;
Case Else
End Select

View file

@ -51,8 +51,9 @@ Global Const V_SFOBJECT = 103 &apos; ScriptForge object: has Object
Global Const V_BASICOBJECT = 104 &apos; User Basic object
Type _ObjectDescriptor &apos; Returned by the _VarTypeObj() method
iVarType As Integer &apos; One of the V_NOTHING, V_xxxOBJECT constants
sObjectType As String &apos; Either &quot;&quot; or &quot;com.sun.star...&quot; or a ScriptForge object type (ex. &quot;SF_SESSION&quot; or &quot;DICTIONARY&quot;)
iVarType As Integer &apos; One of the V_NOTHING, V_xxxOBJECT constants
sObjectType As String &apos; Either &quot;&quot; or &quot;com.sun.star...&quot; or a ScriptForge object type (ex. &quot;SF_SESSION&quot; or &quot;DICTIONARY&quot;)
sServiceName As String &apos; Either &quot;&quot; or the service name of a ScriptForge object type (ex. &quot;ScriptForge.Exception&quot;-
End Type
REM ================================================================== EXCEPTIONS
@ -1065,6 +1066,7 @@ Try:
With oObjDesc
.iVarType = VarType(pvValue)
.sObjectType = &quot;&quot;
.sServiceName = &quot;&quot;
bUno = False
If .iVarType = V_OBJECT Then
If IsNull(pvValue) Then
@ -1089,6 +1091,7 @@ Try:
bUno = False
&apos; Try if the Basic object has an ObjectType property
.sObjectType = oValue.ObjectType
.sServiceName = oValue.ServiceName
End If
&apos; Derive the return value from the object type
Select Case True

View file

@ -14,7 +14,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice&bug_status=UNCONFIRMED&component=UI\n"
"POT-Creation-Date: 2022-03-09 14:52:15\n"
"POT-Creation-Date: 2022-05-04 18:07:20\n"
"PO-Revision-Date: YYYY-MM-DD HH:MM:SS\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
@ -952,4 +952,24 @@ msgctxt "PYTHONSHELL"
msgid ""
"The APSO extension could not be located in your LibreOffice "
"installation."
msgstr ""
#. SFUnitTest could not locate the library gven as argument
#. %1: The name of the library
#, kde-format
msgctxt "UNITTESTLIBRARY"
msgid ""
"The requested library could not be located.\n"
"The UnitTest service has not been initialized.\n"
"\n"
"Library name : « %1 »"
msgstr ""
#. SFUnitTest finds a RunTest() call in a inappropriate location
#. %1: The name of a method
#, kde-format
msgctxt "UNITTESTMETHOD"
msgid ""
"The method '%1' is unexpected in the current context.\n"
"The UnitTest service cannot proceed further with the on-going test."
msgstr ""

View file

@ -14,7 +14,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice&bug_status=UNCONFIRMED&component=UI\n"
"POT-Creation-Date: 2022-03-09 14:52:15\n"
"POT-Creation-Date: 2022-05-04 18:07:20\n"
"PO-Revision-Date: YYYY-MM-DD HH:MM:SS\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
@ -952,4 +952,24 @@ msgctxt "PYTHONSHELL"
msgid ""
"The APSO extension could not be located in your LibreOffice "
"installation."
msgstr ""
#. SFUnitTest could not locate the library gven as argument
#. %1: The name of the library
#, kde-format
msgctxt "UNITTESTLIBRARY"
msgid ""
"The requested library could not be located.\n"
"The UnitTest service has not been initialized.\n"
"\n"
"Library name : « %1 »"
msgstr ""
#. SFUnitTest finds a RunTest() call in a inappropriate location
#. %1: The name of a method
#, kde-format
msgctxt "UNITTESTMETHOD"
msgid ""
"The method '%1' is unexpected in the current context.\n"
"The UnitTest service cannot proceed further with the on-going test."
msgstr ""

View file

@ -0,0 +1,202 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="SF_Register" script:language="StarBasic" script:moduleType="normal">REM =======================================================================================================================
REM === The ScriptForge library and its associated libraries are part of the LibreOffice project. ===
REM === The SFUnitTests library is one of the associated libraries. ===
REM === Full documentation is available on https://help.libreoffice.org/ ===
REM =======================================================================================================================
Option Compatible
Option Explicit
&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
&apos;&apos;&apos; SF_Register
&apos;&apos;&apos; ===========
&apos;&apos;&apos; The ScriptForge framework includes
&apos;&apos;&apos; the master ScriptForge library
&apos;&apos;&apos; a number of &quot;associated&quot; libraries SF*
&apos;&apos;&apos; any user/contributor extension wanting to fit into the framework
&apos;&apos;&apos;
&apos;&apos;&apos; The main methods in this module allow the current library to cling to ScriptForge
&apos;&apos;&apos; - RegisterScriptServices
&apos;&apos;&apos; Register the list of services implemented by the current library
&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
REM ================================================================== EXCEPTIONS
Private Const UNITTESTLIBRARYERROR = &quot;UNITTESTLIBRARYERROR&quot;
REM ============================================================== PUBLIC METHODS
REM -----------------------------------------------------------------------------
Public Sub RegisterScriptServices() As Variant
&apos;&apos;&apos; Register into ScriptForge the list of the services implemented by the current library
&apos;&apos;&apos; Each library pertaining to the framework must implement its own version of this method
&apos;&apos;&apos;
&apos;&apos;&apos; It consists in successive calls to the RegisterService() and RegisterEventManager() methods
&apos;&apos;&apos; with 2 arguments:
&apos;&apos;&apos; ServiceName: the name of the service as a case-insensitive string
&apos;&apos;&apos; ServiceReference: the reference as an object
&apos;&apos;&apos; If the reference refers to a module, then return the module as an object:
&apos;&apos;&apos; GlobalScope.Library.Module
&apos;&apos;&apos; If the reference is a class instance, then return a string referring to the method
&apos;&apos;&apos; containing the New statement creating the instance
&apos;&apos;&apos; &quot;libraryname.modulename.function&quot;
With GlobalScope.ScriptForge.SF_Services
.RegisterService(&quot;UnitTest&quot;, &quot;SFUnitTests.SF_Register._NewUnitTest&quot;) &apos; Reference to the function initializing the service
End With
End Sub &apos; SFUnitTests.SF_Register.RegisterScriptServices
REM =========================================================== PRIVATE FUNCTIONS
REM -----------------------------------------------------------------------------
Public Function _NewUnitTest(Optional ByVal pvArgs As Variant) As Object
&apos;&apos;&apos; Create a new instance of the SF_UnitTest class
&apos; Args:
&apos;&apos;&apos; Location: if empty, the location of the library is presumed to be in GlobalScope.BasicLibraries
&apos;&apos;&apos; Alternatives are:
&apos;&apos;&apos; - the name of a document: see SF_UI.WindowName
&apos;&apos;&apos; - an explicit SFDocuments.Document instance
&apos;&apos;&apos; - the component containing the library, typically ThisComponent
&apos;&apos;&apos; LibraryName: the name of the library containing the test code
&apos;&apos;&apos; Returns:
&apos;&apos;&apos; The instance or Nothing
&apos;&apos;&apos; Exceptions:
&apos;&apos;&apos; UNITTESTLIBRARYNOTFOUND The library could not be found
Dim oUnitTest As Object &apos; Return value
Dim vLocation As Variant &apos; Alias of pvArgs(0)
Dim vLibraryName As Variant &apos; alias of pvArgs(1)
Dim vLocations As Variant &apos; &quot;user&quot;, &quot;share&quot; or document
Dim sLocation As String &apos; A single location
Dim sTargetLocation As String &apos; &quot;user&quot; or the document name
Dim vLanguages As Variant &apos; &quot;Basic&quot;, &quot;Python&quot;, ... programming languages
Dim sLanguage As String &apos; A single programming language
Dim vLibraries As Variant &apos; Library names
Dim sLibrary As String &apos; A single library
Dim vModules As Variant &apos; Module names
Dim sModule As String &apos; A single module
Dim vModuleNames As Variant &apos; Module names
Dim oRoot As Object &apos; com.sun.star.script.browse.BrowseNodeFactory
Dim iLibrary As Integer &apos; The index of the target location in vLibraries
Dim FSO As Object &apos; SF_FileSystem
Dim i As Integer, j As Integer, k As Integer, l As Integer
Const cstService = &quot;SFUnitTests.UnitTest&quot;
If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
Check:
If IsMissing(pvArgs) Or IsEmpty(pvArgs) Then pvArgs = Array()
If UBound(pvArgs) &gt;= 0 Then vLocation = pvArgs(0) Else vLocation = &quot;&quot;
If IsEmpty(vLocation) Then vLocation = &quot;&quot;
If UBound(pvArgs) &gt;= 1 Then vLibraryName = pvArgs(1) Else vLibraryName = &quot;&quot;
If IsEmpty(vLibraryName) Then vLibraryName = &quot;&quot;
If Not ScriptForge.SF_Utils._Validate(vLocation, &quot;Location&quot;, Array(V_STRING, ScriptForge.V_OBJECT)) Then GoTo Finally
If Not ScriptForge.SF_Utils._Validate(vLibraryName, &quot;LibraryName&quot;, V_STRING) Then GoTo Finally
Set oUnitTest = Nothing
Set FSO = CreateScriptService(&quot;ScriptForge.FileSystem&quot;)
&apos; Determine the library container hosting the test code
&apos; Browsing starts from root element
Set oRoot = SF_Utils._GetUNOService(&quot;BrowseNodeFactory&quot;).createView(com.sun.star.script.browse.BrowseNodeFactoryViewTypes.MACROORGANIZER)
If Len(vLibraryName) &gt; 0 Then
&apos; Determine the target location, as a string. The location is either:
&apos; - the last component of a document&apos;s file name
&apos; - &quot;user&quot; = My Macros &amp; Dialogs
If VarType(vLocation) = ScriptForge.V_OBJECT Then
sTargetLocation = FSO.GetName(vLocation.URL)
ElseIf Len(vLocation) = 0 Then
sTargetLocation = &quot;user&quot; &apos; Testing code is presumed NOT in &quot;share&quot;
Else
sTargetLocation = FSO.GetName(vLocation)
End If
&apos; Exploration is done via tree nodes
iLibrary = -1
If Not IsNull(oRoot) Then
If oRoot.hasChildNodes() Then
vLocations = oRoot.getChildNodes()
For i = 0 To UBound(vLocations)
sLocation = vLocations(i).getName()
If sLocation = sTargetLocation Then
If vLocations(i).hasChildNodes() Then
vLanguages = vLocations(i).getChildNodes()
For j = 0 To UBound(vLanguages)
sLanguage = vLanguages(j).getName()
&apos; Consider Basic libraries only
If sLanguage = &quot;Basic&quot; Then
If vLanguages(j).hasChildNodes() Then
vLibraries = vLanguages(j).getChildNodes()
For k = 0 To UBound(vLibraries)
sLibrary = vLibraries(k).getName()
&apos; Consider the targeted library only
If sLibrary = vLibraryName Then
iLibrary = k
If vLibraries(k).hasChildNodes() Then
vModules = vLibraries(k).getChildNodes()
vModuleNames = Array()
For l = 0 To UBound(vModules)
sModule = vModules(l).getName()
vModuleNames = ScriptForge.SF_Array.Append(vModuleNames, sModule)
Next l
End If
Exit For
End If
Next k
End If
End If
If iLibrary &gt;= 0 Then Exit For
Next j
End If
End If
If iLibrary &gt;= 0 Then Exit For
Next i
End If
End If
If iLibrary &lt; 0 Then GoTo CatchLibrary
End If
Try:
&apos; Create the unittest Basic object and initialize its attributes
Set oUnitTest = New SF_UnitTest
With oUnitTest
Set .[Me] = oUnitTest
If Len(vLibraryName) &gt; 0 Then
.LibrariesContainer = sTargetLocation
.Scope = Iif(sTargetLocation = &quot;user&quot;, &quot;application&quot;, &quot;document&quot;)
.Libraries = vLibraries
.LibraryName = sLibrary
.LibraryIndex = iLibrary
.Modules = vModules
.ModuleNames = vModuleNames
._ExecutionMode = .FULLMODE
._WhenAssertionFails = .FAILSTOPSUITE
&apos; Launch the test timer
.TestTimer = CreateScriptService(&quot;ScriptForge.Timer&quot;, True)
Else
._ExecutionMode = .SIMPLEMODE
._WhenAssertionFails = .FAILIMMEDIATESTOP
End If
End With
Finally:
Set _NewUnitTest = oUnitTest
Exit Function
Catch:
GoTo Finally
CatchLibrary:
ScriptForge.SF_Exception.RaiseFatal(UNITTESTLIBRARYERROR, vLibraryName)
GoTo Finally
End Function &apos; SFUnitTests.SF_Register._NewUnitTest
REM ============================================== END OF SFUNITTESTS.SF_REGISTER
</script:module>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="__License" script:language="StarBasic" script:moduleType="normal">
&apos;&apos;&apos; Copyright 2019-2022 Jean-Pierre LEDURE, Rafael LIMA, Alain ROMEDENNE
REM =======================================================================================================================
REM === The ScriptForge library and its associated libraries are part of the LibreOffice project. ===
REM === The SFUnitTests library is one of the associated libraries. ===
REM === Full documentation is available on https://help.libreoffice.org/ ===
REM =======================================================================================================================
&apos;&apos;&apos; ScriptForge is distributed in the hope that it will be useful,
&apos;&apos;&apos; but WITHOUT ANY WARRANTY; without even the implied warranty of
&apos;&apos;&apos; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
&apos;&apos;&apos; ScriptForge is free software; you can redistribute it and/or modify it under the terms of either (at your option):
&apos;&apos;&apos; 1) The Mozilla Public License, v. 2.0. If a copy of the MPL was not
&apos;&apos;&apos; distributed with this file, you can obtain one at http://mozilla.org/MPL/2.0/ .
&apos;&apos;&apos; 2) The GNU Lesser General Public License as published by
&apos;&apos;&apos; the Free Software Foundation, either version 3 of the License, or
&apos;&apos;&apos; (at your option) any later version. If a copy of the LGPL was not
&apos;&apos;&apos; distributed with this file, see http://www.gnu.org/licenses/ .
</script:module>

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="SFUnitTests" library:readonly="false" library:passwordprotected="false"/>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="SFUnitTests" library:readonly="false" library:passwordprotected="false">
<library:element library:name="__License"/>
<library:element library:name="SF_UnitTest"/>
<library:element library:name="SF_Register"/>
</library:library>