citrusframework / citrus

Framework for automated integration tests with focus on messaging integration
https://citrusframework.org
Apache License 2.0
445 stars 135 forks source link

Citrus for java 11 does not support later versions of TestNG #1146

Closed itsMCD closed 2 months ago

itsMCD commented 2 months ago

Citrus Version 6.4.0

Expected behavior Be able to use (initialise and run tests) with testNG version 7.x

Actual behavior Throws the following exception:

org.testng.TestNGException: 
Native Injection is NOT supported for @BeforeSuite annotated beforeSuite.
For more information on native dependency injection please refer to https://testng.org/#_dependency_injection

    at org.testng.internal.Parameters.checkParameterTypes(Parameters.java:442)
    at org.testng.internal.Parameters.createParametersForMethod(Parameters.java:347)
    at org.testng.internal.Parameters.createParameters(Parameters.java:699)
    at org.testng.internal.Parameters.createConfigurationParameters(Parameters.java:163)
    at org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:313)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:358)
    at org.testng.SuiteRunner.run(SuiteRunner.java:312)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1274)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1208)
    at org.testng.TestNG.runSuites(TestNG.java:1112)
    at org.testng.TestNG.run(TestNG.java:1079)
    at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:65)
    at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:105)

(this was previously mentioned in issue #3029 but was only fixed for the latest Java 17 version of Citrus. A lot of projects still use a java version below 17 and want to avoid using testNG 6.x due to vulnerabilities. Test case sample

Use testNG and relevant setup with the following test class


import com.consol.citrus.annotations.CitrusTest;
import com. consol. citrus. testng. spring.TestNGCitrusSpringSupport
import org.testng.annotations.Test;

public class ITtest extends TestNGCitrusSpringSupport{

@Test @CitrusTest public void testTest() throws Exception { //request }

}

bbortt commented 2 months ago

I agree that this is a reasonable request. @christophd and I anticipated that such a request might arise eventually. Our consensus was to evaluate backports as they become necessary, which applies to the current situation.

I am willing to attempt a backport of the fix to v3.x. I remember the fix for JDK >= 17 as being rather little. Maybe a cherry-pick is enough, even.

Given that the release scripts are available in the repository, @christophd, do you think it would be feasible to manage a backport fix release without significant effort?

bbortt commented 2 months ago

just for clarification @itsMCD: you are using citrus 3.4.0 (reference)?

because it contains <testng.version>7.7.1</testng.version> (reference). I assume you meant that, because version v6.4.0 of citrus does not exist (yet). and testng version v6.x is from 2018 (reference).

I then assume you would love to see it being upgraded to the latest version (as of today), e.g. v7.10.1.

itsMCD commented 2 months ago

@bbortt yes sorry, We are currently using Citrus 3.4.0 which which does not support TestNG v 7.x and the versions of TestNG 6.X contains vulnerabilities. Thus yes, I would like to see it upgraded to TestNG V 7.10.1. Thank you tl:dr Current latest citrus version compatible with Java 11 is 3.4.0 which does not support TestNG 7.X, and would thus request support for TestNG 7.x

bbortt commented 2 months ago

Current latest citrus version compatible with Java 11 is 3.4.0 which does not support TestNG 7.X, and would thus request support for TestNG 7.x

it is already on testng@7.7.1, as mentioned (see pom.xml). I've opened https://github.com/citrusframework/citrus/pull/1148 which upgrades it to v7.10.1.

that fulfils your request, right? or am I missing something here?

christophd commented 2 months ago

@bbortt yes, I can do a release then

bbortt commented 2 months ago

@christophd backport has been merged into https://github.com/citrusframework/citrus/tree/support/3.0.0.

christophd commented 2 months ago

@bbortt cool, thanks! I am traveling a lot this week, so hopefully I find some time next week to do the release.

christophd commented 2 months ago

The release is done. v3.4.1 is available!