You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Jacques Le Roux (Jira)" <ji...@apache.org> on 2024/04/01 10:55:00 UTC

[jira] [Created] (OFBIZ-12985) Groovy tests fails

Jacques Le Roux created OFBIZ-12985:
---------------------------------------

             Summary: Groovy tests fails
                 Key: OFBIZ-12985
                 URL: https://issues.apache.org/jira/browse/OFBIZ-12985
             Project: OFBiz
          Issue Type: Bug
          Components: ALL APPLICATIONS, ALL PLUGINS
    Affects Versions: Upcoming Branch
            Reporter: Jacques Le Roux
             Fix For: Upcoming Branch


Groovy testIntegration, tests suites and tests cases no longer work

It seems testIntegrations work but when you look at the log you find a lot of (46, barely same than number of files: 44, did not digg more) "Unable to load test suite class" errors like this 1st one:
bq. |ModelTestSuite |E| Unable to load test suite class : org.apache.ofbiz.party.PartyTests

You can find that in last ofbizTrunkFrameworkPlugins BB build: [https://ci2.apache.org/#/builders/46/builds/777]

The result seems successful. It's a misleading testIntegration result (not sure what does that) and an already old one. TestIntegrations still work in 18.12 and it's somehow related to OFBIZ-12923.

It's a really confusing situation. There are many reasons for that.
Several issues prevent Groovy tests to work. Moreover, at this stage of investigation, some solutions seem opposite. And none completely works.

It has somehow already been reported in build.gradle by in OFBIZ-12813: [https://s.apache.org/7xsza]
{quote}
// Groovy tests often fail, because JUNIT does not have access to the ofbiz enviroment.
// If a groovy test is supposed to be tested this way, it can be added here.
{quote}
But has been neglected, certainly because of the misleading testIntegration result .
Moreover, do we really need to put all Groovy tests files there by hand (44), like we have excludedJavaSources in build.gradle (9 files)?

The 1st reason is due to wrong Groovy tests package names and locations.
If we refer to our way of naming package they are correctly referenced in testdef (eg org.apache.ofbiz.accounting vs org.apache.accounting.accounting)
So it's only a simple package name and location changes.

But then arise another issue: how to compile all concerned Groovy files.
AFAIK correctly set build.gradle sourceSets and a complete build must be done.
None of tasks from [https://docs.gradle.org/current/userguide/groovy_plugin.html] completely work. Weirdly compileSourceSetGroovy fails with:
bq. Task 'compileSourceSetGroovy' not found in root project 'ofbiz' and its subprojects.
when compileGroovy and compileTestGroovy succeed but not with the totally expected result, even wehn cleaning before.

Also I have tried several sourceSets combinations, none work completely.
For instance if you add
bq. srcDirs = getDirectoryInActiveComponentsIfExists('src/test/groovy')
you need also to exclude ModelServiceTest.groovy, eg:
bq. exclude 'org/apache/ofbiz/service/ModelServiceTest.groovy' // TODO why it fails to compile despite org.mockito.Mockito present at least in Eclipse and in dependencies.Gradle? I guess to move to src/main/groovy, not sure.

Among several combination I have also tried in test sourceSet
{noformat}
groovy {
            srcDirs = getDirectoryInActiveComponentsIfExists('src/main/groovy')
            include 'org/apache/ofbiz/service/engine/GroovyBaseScript.groovy'
            srcDirs = getDirectoryInActiveComponentsIfExists('src/test/groovy')
            include 'org/apache/ofbiz/service/ModelServiceTest.groovy'
            include 'org/apache/ofbiz/test/TestServices.groovy'
            include 'org/apache/ofbiz/base/util/FileUtilTests.groovy'
            include 'org/apache/ofbiz/accounting/InvoicePerShipmentTests.groovy'
        }
{noformat}
I don't link OFBIZ-12923 as a breaking issue, because the problem is more in compiling Groovy tests.

Maybe I miss something about compiling Groovy tests, anyway we need to seriously look at it. It's critical (44 test files bypassed).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)