Hello Gaetan,

I do all this as you describe, source path for tests is as required and
tests are properly annotated.
The main difference is that this is not a unit test out of a framework, but
unit tests sitting in a plugin component.

I so not see any traces of the framework stepping into my test directories
when executing test (I ran .gradlew test —info to get more info).

IMO something is probably missing in my build.gradle:

/*…*/

dependencies {
    // information: the ofbiz:release22.01 is on
jakarta.ws.rs:jakarta.ws.rs-api:2.1.6
    pluginLibsCompile 'org.glassfish.jersey.inject:jersey-hk2:2.31'
    pluginLibsCompile
'org.glassfish.jersey.containers:jersey-container-servlet:2.31'
    pluginLibsCompile
'org.glassfish.jersey.media:jersey-media-json-jackson:2.31'
    pluginLibsCompile 'javax.json:javax.json-api:1.1.4'
    pluginLibsCompile 'jakarta.inject:jakarta.inject-api:2.0.1'
    pluginLibsCompile 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6'
    pluginLibsCompile 'com.fasterxml.jackson.core:jackson-annotations:2.16.1'
    pluginLibsCompile 'com.fasterxml.jackson.core:jackson-core:2.16.1'
    pluginLibsCompile 'com.fasterxml.jackson.core:jackson-databind:2.16.1'
    pluginLibsCompile
'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1'
    // Swagger Annotations for OpenAPI
    pluginLibsCompile 'io.swagger.core.v3:swagger-annotations:2.2.20'
    // Swagger JAX-RS Integration for OpenAPI
    pluginLibsCompile 'io.swagger.core.v3:swagger-jaxrs2:2.2.20'
    // Swagger UI
    pluginLibsCompile 'org.webjars:swagger-ui:4.1.3'
    // Junit core, api and parameterization
    pluginLibsCompile 'org.junit.jupiter:junit-jupiter:5.10.0'
    pluginLibsCompile 'org.junit.jupiter:junit-jupiter-api:5.10.0'
    pluginLibsCompile 'org.junit.jupiter:junit-jupiter-params:5.10.0'
}

task install {
    doLast {
        // Install logic for this plugin
    }
}

task uninstall {
    doLast {
        // uninstall logic for this plugin
    }
}


I have dependencies on JUnit 5 since I want to use the ParameterizedTest
feature available there. Maybe that is the issue. I also cannot find a
passing build when stating these dependencies as pluginCompileOnly either.

So almost certainly this is rather a hook into the test executionon grade
side, WDYT?

Thanks for your comments so far!
Warm regards


Carsten


Am 10.06.2024 um 17:54 schrieb Gaetan <gaetan.chabous...@nereide.fr>:

Hi again,

After some research, it seems you should follow this kind of structure for
your unit tests :

https://github.com/apache/ofbiz-framework/blob/7c2487bc3f1a6ec472585c27d7ceb5ca19471387/build.gradle#L259

So you should setup your tests at the right package (either groovy or java
according to build instructions) and add the test decorator like this
example

https://github.com/apache/ofbiz-framework/blob/7c2487bc3f1a6ec472585c27d7ceb5ca19471387/framework/base/src/test/java/org/apache/ofbiz/base/container/ComponentContainerTest.java#L63

Please let me know if you encounter any more trouble !

Regards

Gaetan

On 6/10/24 16:55, Carsten Schinzer wrote:

… and after some more assertions, I can add:
I have verified the paths to all my test suites to point to the correct
Java classes.
I do not find any error in the test logs.
I do find the classes in the build/classes/java/test directory.
I do not find related test results at all.

An hint you can give me is appreciated!
Warm regards


Carsten

Am 10.06.2024 um 15:47 schrieb Carsten Schinzer <
cars...@dcs-verkaufssysteme.de>:

Hello,


You mean like this:

<test-suite loader="main" location="testdef/CdcTicketsTests.xml“/
Yes, I think I did it well like that. no?
Warm regards


Carsten



Am 10.06.2024 um 09:17 schrieb Gaetan <gaetan.chabous...@nereide.fr>:

Hi Carsten, did you include your tests in the ofbiz-component file a the
root of your plugin ?

Best regards

Gaetan

On 6/9/24 21:15, Carsten Schinzer wrote:

Hello all,


I am looking for a reference to integrate my plugin unit tests into the
test run of OfBiz, i.e. when I run

./gradlew test

My defined test suite should be included and executed.

I did browse the official plugin repository and found no reference.

First issue: how to define the hook into the test task in build.gradle.
Second: Ho to make sure, the build.gradle dependencies on JUnit are only
loaded for test and not packaged.

Does anyone have an example possibly how to do this.

Thanks & warm regards


Carsten

Reply via email to