Bug 163016 - We need the ability to write Basic Unit Tests for built-in Basic libraries
Summary: We need the ability to write Basic Unit Tests for built-in Basic libraries
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
25.2.0.0 alpha0+
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Dev-related
  Show dependency treegraph
 
Reported: 2024-09-17 19:40 UTC by Rafael Lima
Modified: 2025-01-07 10:53 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Lima 2024-09-17 19:40:25 UTC
Currently, LibreOffice ships with various built-in Basic Libraries, such as Gimmicks, Tools, ScriptForge etc. However, we are unable to provide unit tests for these libraries and avoid unexpected breakages (see f.i. bug 162962).

In the case of ScriptForge, we would like to integrate unit tests into LibreOffice's CI, however we have not been able to do so, because the current Basic unit tests are unable to access the built-in Basic libraries.

Ideally, it should be possible to create Basic tests in basic/qa/basic_coverage/ as we currently do to test the language itself. See for instance of a prototype of what I think should be possible in:

https://gerrit.libreoffice.org/c/core/+/173485

The test above fails because it is unable to access GlobalScope.BasicLibraries.

Alternatively, I have already tried writing Cpp tests as the ones in:

/core/sc/qa/extras/macros-test.cxx

However, only the document's Standard library is loaded at runtime, so testing ScriptForge with Cpp tests is currently not viable.

In summary, we need a testing environment where built-in Basic libraries are accessible by Basic and/or Cpp unit tests.
Comment 1 Rafael Lima 2024-09-17 19:50:05 UTC
@Xisco, @Mike any idea what to do about this?

Also, who else can help us with this?
Comment 2 Xisco Faulí 2024-09-17 20:20:50 UTC
would it work to do something like we do for autocorrect dictionaries ?
See extras/Package_autocorr.mk and sw/CppunitTest_sw_uiwriter6.mk?
Comment 3 Rafael Lima 2024-09-17 21:42:11 UTC
(In reply to Xisco Faulí from comment #2)
> would it work to do something like we do for autocorrect dictionaries ?
> See extras/Package_autocorr.mk and sw/CppunitTest_sw_uiwriter6.mk?

I read the tests in the file

 /core/sw/qa/extras/uiwriter/uiwriter6.cxx

I could not find anything there that calls Basic scripts. Am I looking at the correct file?
Comment 4 Xisco Faulí 2024-09-18 06:56:41 UTC
(In reply to Rafael Lima from comment #3)
> (In reply to Xisco Faulí from comment #2)
> > would it work to do something like we do for autocorrect dictionaries ?
> > See extras/Package_autocorr.mk and sw/CppunitTest_sw_uiwriter6.mk?
> 
> I read the tests in the file
> 
>  /core/sw/qa/extras/uiwriter/uiwriter6.cxx
> 
> I could not find anything there that calls Basic scripts. Am I looking at
> the correct file?

Hi Rafael,
No there is nothing related to Basic script in those tests. What I meant is, adding

$(call gb_CppunitTest_get_target,sw_uiwriter6): $(call gb_Package_get_target,extras_autocorr)

to CppunitTest_sw_uiwriter6 the autocorrect dictionaries are added to be used by those tests. Maybe the same can be done for scriptforge ?