evans
May 6, 2025, 2:44am
1
We’ve setup our TeamCity build as outlined here:TeamCity plugin | Katalon Docs
The required CLI arguments are also setup: Command-line syntax in Katalon Runtime Engine | Katalon Docs
Still, we keep encountering the following error:
Exception caught during Katalon Studio execution.
Cannot invoke “String.isEmpty()” because “segment” is null
Step Run tests (Katalon) failed
Any help would be appreciated. Thank you.
1 Like
To resolve the "String.isEmpty()" because "segment" is null
error in TeamCity with Katalon:
1. Identify the Root Cause
This error occurs when Katalon receives an invalid or malformed path (e.g., a test suite path with empty segments like //
or ""
). Common triggers:
Incorrectly formatted command-line arguments in TeamCity.
Missing/empty parameters in the Katalon test execution command.
Corrupted project files or incorrect workspace paths.
2. Fix the TeamCity Build Configuration
a. Validate Katalon Command Syntax
Ensure your TeamCity build step uses the correct syntax. Example:
katalon.exe -noSplash -runMode=console -projectPath="C:\Katalon_Projects\YourProject.prj" -retry=0 -testSuitePath="Test Suites/YourTestSuite" -reportFolder="Reports" -reportFileName="report"
Critical Checks :
Use absolute paths for -projectPath
.
Enclose paths with spaces in double quotes ("
).
Avoid trailing slashes (e.g., Test Suites/
➔ Test Suites
).
b. Escape Special Characters
For paths with spaces or special characters, use escaped quotes :
katalon.exe -noSplash -runMode=console -projectPath=\"C:\Path With Spaces\YourProject.prj\" -testSuitePath=\"Test Suites/Your Suite\"
c. Split Arguments Clearly
In TeamCity, configure the Katalon command as separate Command Line parameters instead of a single string:
Runner type: Command Line
Command executable: katalon.exe
Command parameters:
-noSplash
-runMode=console
-projectPath="C:\YourProject.prj"
-testSuitePath="Test Suites/YourTestSuite"
3. Update Katalon and Plugins
Upgrade Katalon Studio/Runtime Engine to the latest version (e.g., 8.5+).
Reinstall the TeamCity Plugin to rule out corruption.
4. Check Project Structure
Verify that the Test Suites/YourTestSuite
path exists in your project.
Ensure no test suite names contain invalid characters (/
, \
, :
).
5. Debug with Logs
Add verbose logging to pinpoint the failing segment:
katalon.exe ... --info-log --log-file=debug.log
Inspect debug.log
for lines containing segment
or path
.
6. Rebuild the Project
Delete the bin
, Libs
, and .idea
folders in your Katalon project.
Reopen the project in Katalon Studio and refresh dependencies (Right-click project > Refresh ).
7. Sample Working Configuration
TeamCity Build Step :
Runner type: Command Line
Working directory: C:\BuildAgent\work\YourProject
Command executable: katalon.exe
Command parameters:
-noSplash
-runMode=console
-projectPath="C:\BuildAgent\work\YourProject\YourProject.prj"
-testSuitePath="Test Suites/Smoke Tests"
-browserType="Chrome"
-retry=0
-reportFolder="Reports"
-reportFileName="Report_%build.number%"
8. Alternative: Use Docker
If local paths are inconsistent, run Katalon in a Docker container:
docker run -v "$(pwd):/katalon/katalon-volume" katalonstudio/katalon katalon-execute.sh -projectPath="/katalon/katalon-volume/YourProject.prj" -testSuitePath="Test Suites/YourTestSuite"
Why This Happens
Katalon splits paths into segments (e.g., Test Suites/YourTestSuite
➔ ["Test Suites", "YourTestSuite"]
). A null
segment indicates a malformed path like Test Suites//YourTestSuite
evans
May 10, 2025, 3:42pm
3
Had a troubleshooting session with Katalon support. The issue was resolved by specifying the Katalon Studio version in the Build Step.
2 Likes
thank you for sharing the solution!!