Hello,
I downloaded Katalon version 10.2.
In this version, the Cucumber version is only compatible with Java 24 (otherwise errors occur in the console which prevent the launch).
After several tests, this same version 24 does not allow the RUN of test cases or test suites to work (this is fine with Java versions 23 and lower).
Therefore, it is impossible to use test cases/suites and Cucumber simultaneously without having to systematically change the Java version via Katalon Studio References.
How can this problem be resolved ?
Additional informations :
Windows 10 Enterprise
Katalon 10.2
Chrome Versions : 125.0.6422.142 / 135.0.7049.115
1 Like
To resolve the Java version conflict between running standard test cases and Cucumber tests in Katalon 10.2, follow these steps:
Solution
1. Use Java 17 (Recommended for Katalon 10.2)
- Katalon 10.2 is optimized for Java 17 (LTS). Ensure your project uses Java 17 for both Cucumber and standard tests.
- Set Java 17 in Katalon Studio:
- Go to Window > Preferences > Katalon > Java.
- Point to a Java 17 JDK installation (e.g., Eclipse Temurin 17).
2. Adjust Cucumber Dependencies
- If the bundled Cucumber version requires Java 24, override it with a version compatible with Java 17.
- Modify
build.gradle
in your project:
dependencies {
// Use Cucumber-JVM 7.14.0 (works with Java 8+)
implementation 'io.cucumber:cucumber-java:7.14.0'
implementation 'io.cucumber:cucumber-junit:7.14.0'
}
- Run
gradle katalonCopyDependencies
to apply changes.
3. Reconfigure Test Execution
- For Cucumber Tests:
- Use the Cucumber Keywords with the updated dependencies.
- For Standard Test Cases/Suites:
- Ensure no Java 24 features (e.g., new language syntax) are used if targeting Java 17.
4. Check Execution Profiles
- Verify that your Execution Profiles (in Run Configurations) do not override the Java version.
5. Clean and Rebuild
- Delete the
bin
, Libs
, and build
folders in your project.
- Refresh the project and rebuild dependencies via Project > Clean.
6. Verify Compatibility
- Ensure all plugins and libraries (e.g., Appium, Selenium) support Java 17.
Why This Happens
- Cucumber in Katalon 10.2 may default to a newer Java version (e.g., 24), while standard tests require older versions (e.g., 17 or 11).
- Java 24 (or other newer versions) might introduce breaking changes incompatible with Katalon’s core engine.
Alternative Workaround
If you must use Java 24 for Cucumber:
- Separate Projects: Create two projects:
- Project A: Uses Java 24 for Cucumber tests.
- Project B: Uses Java 17 for standard tests.
- Switch JREs via Script (Advanced):
- Use a batch script to switch Katalon’s JRE before execution:
# For Cucumber
set KATALON_JRE_PATH=C:\path\to\java24
katalon.exe -run
# For standard tests
set KATALON_JRE_PATH=C:\path\to\java17
katalon.exe -run
Hello Dinesh,
Thanks for your feedback.
Could you please tell me how to perform the action in step 3 :
Thanks !
To run the gradle katalonCopyDependencies
command and apply your dependency changes in Katalon Studio, follow these steps:
Step-by-Step Guide
- Open the Gradle Terminal in Katalon Studio:
- In Katalon Studio, go to Window > Show View > Terminal to open the built-in terminal.
- If the Terminal view isn’t available, use an external terminal (e.g., Command Prompt or PowerShell) and navigate to your Katalon project root directory.
- Run the Command:
- Execute the following command to update dependencies and copy them to the
Libs
folder of your project:
# For Windows
gradlew.bat katalonCopyDependencies
# For macOS/Linux
./gradlew katalonCopyDependencies
- This command uses Katalon’s Gradle wrapper (included in your project) to ensure compatibility.
- Wait for Completion:
- Gradle will resolve dependencies from your
build.gradle
file and download them into the Libs
folder. You’ll see a BUILD SUCCESSFUL
message when done.
- Refresh Your Project:
- Right-click your project in the Test Explorer pane and select Refresh to see the updated dependencies.
What This Does
katalonCopyDependencies
is a Gradle task specific to Katalon that:
- Fetches dependencies defined in
build.gradle
.
- Copies the JAR files into the
Libs
folder (used at runtime).
- Ensures Katalon recognizes the new libraries (e.g., Cucumber-JVM 7.14.0).
Verify the Changes
- Check the
Libs
folder in your project to confirm the new Cucumber JARs (e.g., cucumber-java-7.14.0.jar
) are present.
Troubleshooting
- If you see errors like
Could not resolve dependency
, ensure:
- Your
build.gradle
has no typos.
- You have an internet connection (to download dependencies).
- The Gradle wrapper (
gradlew
or gradlew.bat
) is present in your project root.