KRE 9.3.1 fails to load Keywords when executing the first TCs, but eventually gets them later in the run

Hello,

Weird surprise after upgrading to KRE 9.3.1.

Most of our test cases start by calling a custom keyword:
CustomKeywords.'testdata.someModule.Function'('someParam')

When running test suites using such test cases, the first test cases fail, with KRE logging:

Reason:
java.lang.ClassNotFoundException: testdata.someModule
(...) at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194) 
etc etc

(see stack trace below)

Eventually, after n TCs left KO, at some point, it goes back to normal, it stops complaining about “ClassNotFoundException”, and it works. In other words, KRE starts working correctly only at the (n+1)-th TC.

With KS 9.3.1, running any test suite with such test cases just works. KS starts working correctly at the first TC.

Any idea what’s wrong? Is this a bug of the upgrade? Is there some part of the Java environment that is not loader early enough? Do we need to change some Java setup?

Thanks in advance for any insight.
–Michel

Test Cases/someFolder/someTC FAILED.
Reason:
java.lang.ClassNotFoundException: testdata.someModule
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.getCustomKeywordClassAndSetMetaClass(CustomKeywordDelegatingMetaClass.java:105)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
	at someTC.run(mysource:9)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:448)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
	at com.kms.katalon.core.common.CommonExecutor.accessTestCaseMainPhase(CommonExecutor.java:65)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:148)
	at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:106)
	at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:180)
	at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
	at TempTestSuite1709455911422.run(TempTestSuite1709455911422.groovy:35)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Another fact: This issue does not exist with KRE 9.3.0.

But with KRE 9.3.0, as with KRE 9.1.0, we face another issue in the same area: your very first Test Suite may not be executed. See bug description under https://forum.katalon.com/t/kre-9-1-0-does-not-run-the-first-testsuite-of-a-testsuitecollection-the-next-are-fine/110556 .

In both cases, it seems KRE may have an issue with in the first minutes of a run. It feels like it starts too quickly, while its contexts are not fully loaded.

In both cases, it should be fixed.

Regards,
–Michel

Hi,

Thank you for letting us know. We will investigate this and let you know soon