Groovy kept throwing Groovy:unable to resolve class com.kms.katalon.* warnings on Gitlab-CI log

I got a ton of warnings shown on Gitlab-CI when the runner was running. The messages were in the form of ‘Groovy:unable to resolve class com.kms.katalon.*’. For example,

Groovy:unable to resolve class com.kms.katalon.core.annotation.Keyword
Groovy:unable to resolve class com.kms.katalon.core.testobject.ObjectRepository
Groovy:unable to resolve class com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords
Groovy:unable to resolve class com.kms.katalon.core.model.FailureHandling
Groovy:unable to resolve class com.kms.katalon.core.testdata.TestDataFactory
Groovy:unable to resolve class com.kms.katalon.core.testobject.TestObject
...

To be more specific, it resolved nothing but the tests could still be executed successfully. I am guessing that the problem lies in some files I didn’t push to the gitlab repo. In that case, what files should be included in the .gitignore file? Here is mine:

.classpath
Reports/
.project
/bin/lib/Temp*.class
/Libs/Temp*.groovy
/.settings

Many thanks in advance.

2 Likes

I am having the same issue while trying to run the tests on a Docker container. Can someone please provide a solution so that these stop appearing.

The test suites do eventually run, but I want to know how these can be prevented.

Version 7.1.1 claims:

Fixes

Bug: Cannot execute test scripts having import paths containing wildcard character ( * ).

See

Which version of KS is running in your docker container? Probably there runs KS of older version.

According to https://github.com/katalon-studio/docker-images, the latest docker image distributed in the Docker Hub is newer than the version 7.2.1. So the problem of Star import (*) should not happen with it.

I have tried t use 6.3.3 and also used the latest version and I am getting the same result.
When I am trying to run my Katalon Tests on multiple containers, they seem to stop working after generating these warnings randomly. I have no idea why that is happening

@Eric_Hung

I guess in your script you have a line as this:

import com.kms.katalon.*

By Java/Groovy language definition, import com.kms.katalon.* tries to import classes that belong to the com.kms.katalon package only. Star import does NOT function recursively to “sub-packages”. In fact, in Java/Groovy, there is no “sub-packages” concept defined. Doubt it? See other resources for example:

So, you need to write full package names one by one:

import com.kms.katalon.core.annotation.*
import com.kms.katalon.core.testobject.*
import com.kms.katalon.core.mobile.keyword.*
import com.kms.katalon.core.model.*
import com.kms.katalon.core.testdata.*

Katalon API has many packages; so I need to write many import com.kms.katalon.core.XXXXX.* statements. Star import statements do not help shortening the code very much.

Personally I never use Star imports in Katalon TestCases.

The “Organize Imports” feature of Eclise editor by Ctrl+Shift+O is far more helpful for me.