Tests are failing with "cannot be cast to groovy.lang.GroovyObject"

hi,

Below is the screenshot of the gradle command execution.

Once the command is executed. gradle folder is generated

The jar generated in build\libs is later copied to plugin folder and then pushed to git repo.

How to develop Custom Keywords Plugins I followed the steps mentioned here.

Hi @chicool.viper

Can you try to copy and paste the Jar file available at build/libs into the Plugin folder ?

I’ve never used the Jar file from the gradle folder, so this may be the difference. One more thing, does the keyword work fine when you’re developing them ? I mean can you use the keyword normally in your own keyword development project ? Previously I assumed you failed at doing this, but I just wanna make sure.

Cheers !

1 Like

Hi @chicool.viper

Did using the Jar file under build/libs work for you ?

I did try to use the jar generated earlier in a project and that had worked.

But now I cannot do any thing as it’s throwing the error

Are you still encountering the same error even though you used the jar file under build/libs folder ? Is the error different or the same as the one before ?

@ThanhTo @Ibus I tried to execute the project on 6.1.2 and 6.3 version of katalon by adding jar generated as external jar. This resulted in a different error.

Steps:

  1. create a generic project
  2. copy the data file, test data, test cases, test suite, object repository into new project created in previous step
  3. add the jar available under (build/lib/aem_katalon_api) in the earlier project structure add as zip or execute gradle katalonpluginpackage into external jar in the project settings
  4. refresh the project
  5. execute the test suite

Below errors are observed in both version :
SLF4J: The requested version 1.7.16 by your slf4j binding is not compatible with [1.6]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
2019-08-06 11:00:29.394 INFO c.k.katalon.core.main.TestSuiteExecutor - START Test Suites/AEM_Author_Test_Suite/Author_Suite
2019-08-06 11:00:29.453 INFO c.k.katalon.core.main.TestSuiteExecutor - hostName = mkarthik - mkarthik-WX-3.mshome.net
2019-08-06 11:00:29.466 INFO c.k.katalon.core.main.TestSuiteExecutor - os = Windows 10 64bit
2019-08-06 11:00:29.468 INFO c.k.katalon.core.main.TestSuiteExecutor - hostAddress = 172.26.216.145
2019-08-06 11:00:29.471 INFO c.k.katalon.core.main.TestSuiteExecutor - katalonVersion = 6.3.0.1
Caught: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.regex.Matcher
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.regex.Matcher
at com.kms.katalon.core.main.AnnotatedMethodCollector.getMethodNodes(AnnotatedMethodCollector.java:106)
at com.kms.katalon.core.main.TestSuiteExecutor$ScriptCache.getMethodNodes(TestSuiteExecutor.java:249)
at com.kms.katalon.core.main.TestSuiteExecutor.invokeTestSuiteMethod(TestSuiteExecutor.java:167)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:114)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:87)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1565069426544.run(TempTestSuite1565069426544.groovy:35)

-------------------------------------------------------------------------------------------------------------------------------------------
SLF4J: The requested version 1.7.16 by your slf4j binding is not compatible with [1.6]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
2019-08-06 11:10:15.779 INFO  c.k.katalon.core.main.TestSuiteExecutor  - START Test Suites/AEM_Author_Test_Suite/Author_Suite
2019-08-06 11:10:15.834 INFO  c.k.katalon.core.main.TestSuiteExecutor  - hostName = mkarthik - mkarthik-WX-3.mshome.net
2019-08-06 11:10:15.846 INFO  c.k.katalon.core.main.TestSuiteExecutor  - os = Windows 10 64bit
2019-08-06 11:10:15.851 INFO  c.k.katalon.core.main.TestSuiteExecutor  - hostAddress = 172.26.216.145
2019-08-06 11:10:15.854 INFO  c.k.katalon.core.main.TestSuiteExecutor  - katalonVersion = 6.1.2.2
Caught: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.regex.Matcher
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.regex.Matcher
	at com.kms.katalon.core.main.AnnotatedMethodCollector.getMethodNodes(AnnotatedMethodCollector.java:106)
	at com.kms.katalon.core.main.TestSuiteExecutor$ScriptCache.getMethodNodes(TestSuiteExecutor.java:227)
	at com.kms.katalon.core.main.TestSuiteExecutor.invokeTestSuiteMethod(TestSuiteExecutor.java:146)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:106)
	at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:81)
	at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
	at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
	at TempTestSuite1565070011817.run(TempTestSuite1565070011817.groovy:35)

The keywords part of the jar are available to be executed when jar is added.

Hi @chicool.viper

That’s good, if the error changed then we are getting somewhere. Can you send me the jar file of your keyword ?

Cheers !

Hi @ThanhTo
The file size is 18 mb and on trying to add it in a zip file its 15 mb and i am unable to upload that. Jar can be done on local using gradle katalonpluginpackage command. Jar file will be generated under build/libs.

Hi,
Any updated on this?

@ThanhTo @Ibus @Russ_Thomas

Thanks and regards,
KARTHIK

@chicool.viper

I tried to build the Jar file but apparently there’s local resources (or at least absolute paths to resources that are local to your machine), I will try to see if I can resolve it and build the jar file. I’ll get back to you when I have something new.

Cheers !

Thanks @ThanhTo,

Please let me know if any other information is required.

Wanted to inform that another member of my team also faced the same issue and is blocked.

For now we will try to use Katalon ignoring jar creation of custom keywords.

Cheers!!!

You can send your project to info@katalon.com if it’s sensitive or too large.

i closed this as it is inactive