Problem adding keyword to a katalon project running with Jenkins

Hello,
We have a project in Katalon that we launch every night using Jenkins. We have modified the project by adding a new keyword. When launching the project automatically with Jenkins, we get an error in the reference we make to this keyword in the testcase that we had already added to the project. If we run the project manually from Katalon, it does not give us any error and the test is launched correctly.
I give you an example of what we have done. It’s very simple, but we don’t see if we are missing something or if something is missing to add in the Jenkins execution.

We have the keyword defined as follows:

And in the testcase we refer to it like this:

When the project is executed in Jenkins, it gives us this error and the execution of the tests stops:
Test Cases/TestCaseCompleto FAILED because (of) (Stack trace: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
file:/srv/jenkins/workspace/Test_Pruebas/Pruebas/Scripts/CompletarTest/Script1556183093928.groovy: 32: unable to resolve class utilidades5.entidades.Prueba

  • @ line 21, column 1.*
  • import utilidades5.entidades.Prueba as Prueba*
  • ^*

1 error

  • at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)*
  • at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:946)*
  • at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593)*
  • at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:542)*
  • at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)*
  • at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)*
  • at com.kms.katalon.core.main.ScriptEngine.getScript(ScriptEngine.java:188)*
  • at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:183)*
  • at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:108)*
  • at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:294)*
  • at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:285)*
  • at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:264)*
  • at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:256)*
  • at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:200)*
  • at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:99)*
  • at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword$_callTestCase_closure1.doCall(CallTestCaseKeyword.groovy:60)*
  • at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword$_callTestCase_closure1.call(CallTestCaseKeyword.groovy)*
  • at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:54)*
  • at com.kms.katalon.core.keyword.builtin.CallTestCaseKeyword.callTestCase(CallTestCaseKeyword.groovy:81)*

Can someone help us? Thanks!

Do you use Git? Does your job in Jenkins clone the project out of a Git repository?

If yes, how is .gitignore file is coded?

The .gitignore should have the following 3 lines:

.cache/
bin/
Libs/

Especially I have a doubt that your .gitignore file does not have a line of

.cache

In the .cache directory, the compiled class files of “Keywords” are saved.
If your .gitignore misses, the .cache contents should have been inluded in the Git reportory, and will be transfered to the Jenkins job. It is likely that the contents of .cache is out of sync with the program source code — this would cause problem.

Sorry, I forgot to add it in the first post. Yes, we are using GIT and we already have the 3 lines you mentioned in .gitignore.

@nzg

Please make sure that .cached is NOT stored in the remote git repository already.

If you find .cache stored in the remote git repository already, you should do the following:

$ cd $projectDir
$ git rm -r --cached .cached
$ git rm -r --cached bin
$ git rm -r --cached Libs
$ git push

This will purge the contents of the .cached directory which were already stored in the repository.

Thanks, solved!