Groovy:unable to resolve keyword class that exists

For some reason, sooner or later, I face the following issue:

  • whilst working on a “custom keyword” (e.g. model, builder, factory), I face a slew of errors claiming the project dependencies don’t exist.

For example: I am working on a factory class, right now, and on importing the dependencies, I get a slew of errors stating that every single business keyword class that I imported can’t be resolved.

It seems to eventually happen no matter what piece of business logic I’m working on. Here’s an example though:

com.xxx.factories.MemberLeadFactory.groovy

package com.xxx.factories

import com.github.javafaker.Address
import com.github.javafaker.DateAndTime
import com.github.javafaker.Faker
import com.xxx.enums.Category
import com.xxx.enums.Frequency
import com.xxx.enums.PaymentMode
import com.xxx.models.memberLead.MemberLeadModel
import com.xxx.utils.SMDDateUtils

public class MemberLeadFactory {
	protected Faker faker;
	protected Address addressFactory;
	protected DateAndTime dateAndTimeFactory;

	public MemberLeadFactory() {
		this.init();
	}

	protected void init() {
		this.faker = new Faker();
		this.addressFactory = faker.address();
		this.dateAndTimeFactory = faker.date();
	}

	public MemberLeadModel createNamedFromFrequency(Frequency frequency, String firstName, String lastName) {
		return new MemberLeadModel(firstName,
				lastName,
				"3175555555", // TODO: use faker number
				"3175555555", // TODO: use faker number
				addressFactory.streetAddress(),
				addressFactory.city(),
				addressFactory.stateAbbr(),
				addressFactory.zipCode(),
				"dev+QuarterlyMember@email.com",
				Category.MEMBERSHIP,
				frequency,
				dateAndTimeFactory.birthday(),
				true,
				SMDDateUtils.toDate("10-01-2021"),
				SMDDateUtils.toDate("10-15-2021"),
				PaymentMode.CHECK,
				);
	}
}

All the business enums, models, and utils have existed looong before writing this factory, at the fully-qualified package names specified, in the Keywords folders. As a matter of fact, they got brought in automatically via CTRL + Shift + O.

Please let us know what you are using Katalon Studio for?

  1. I’m exploring the tool
  2. I’m building a Proof of Concept
    3. I have currently applied Katalon Studio in my project
  3. I’m learning automated test with Katalon Studio

How would your work be affected if this issue has not been resolved?

  1. It doesn’t affect much, but I believe Katalon team should have this ticket resolved
  2. I can continue my job, resolving this ticket can boost my performance
  3. I can continue my job, but my performance is lower than expected
    4. I cannot continue my job and have to work on something else while awaiting your response

Operating System

Windows 10

Katalon Studio Version

Version 8.1

Katalon Studio logs

  • Windows logs folder: \config.metadata.log

  • macOS logs folder: file:///Applications/Katalon%20Studio.app/Contents/MacOS/config/.metadata/log

Screenshots / Videos

  • Please attach screenshots or videos if necessary to reproduce the issue

Environment (for Web testing):

Chrome (but that’s irrelevant)

Expected Behavior:

I am able to continue working, without issue

Actual Behavior:

A slew of issues all over just the business class imports:

The screenshot you attached above indicates that you miss a class named com.sign something.

But you wrote com.xxx.enums.Category and others. I am confused. Different package names will surely cause “Groovy: unable to resolve class” error.

What is the correct package name?

Where the Category class is located in the project? In the Keywords folder? If so, could you show a screenshot of the Category class in the Keywords folder?

Or is the Category class contained in a jar in the Drivers folder?

I hid the company name as this is for work, and don’t want to reveal it.

Rest assured, it matches the imports.

As for your screenshot of that enum, here it is:

It seems like you’re going to ask this for all the dependencies…

It would be an idea to do “Clean-build” once. I mean, you should remove old binaries and recreate them by compiling all *.groovy files to *.class.

  1. close the Katalon Studio project
  2. take a full back-up of the project directory just in case
  3. in the project directory, remove the following folders (these will be recreated when you reopen the project)
  • bin/
  • Libs/
  1. in the project directory, remove the following files
  • .cache
  • .classpath
  • .project
  1. re-open the project.