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

So it’s complaining about this line:

GlobalVariable.cookie = CustomKeywords.'aem_api.Aem_Author_Api.LoginToAemUsingApiAndFetchLoginCookie'(userName, password, authorUrl, loginResource)

Yet the error message is complaining about a resource identifier that differs from this:

cms_api._Author_Api cannot be cast to groovy.lang.GroovyObject

So there’s a discrepancy between what the compiler thinks you are trying to do vs. what your current script shows:

cms_api._Author_Api

vs.

aem_api.Aem_Author_Api

Have you recently renamed any packages/classes in your Custom Keywords? The best quick fix I can recommend is this:

… which basically recompiles all of your project code.

1 Like