Refactoring 'Keywords' doesn't indicate errors on the Test Case that uses them until execution

A long time ago we noticed that you can just call Keywords like Classes and have been using them like that for a long time.

So our Test Cases look more like:

ActionUtil.cancelExistingActions(emplId, emplRcd)
Navigate.navigateToCreateJDC(emplId, emplRcd)

ActionInfoPopulate.populateAll(JDC_TYPE, ACTION_REASON_CODE, effDate)

ApptInfoVerify.verifyAllCreateEdit(DATA, index)

FacultySponsor.facultySponsorLookup(lookupFirstName, lookupLastName, lookupEmplId)
FacultySponsor.verify(newFacultySponsorName, selectEmplId, newFacultySponsorBusinessTitle)


FacultySponsor.verify(newFacultySponsorName, selectEmplId, newFacultySponsorBusinessTitle)


(Note all variables are defined at the top of the test).
Now if I was to change the verify class off of FacultySponsor and instead call it verifySponsorDetails. I could save the keyword just fine without an issue. The test case itself doesn’t indicate that it has a call to a Class.method that doesn’t exist anymore - until I go to execute it.

I was wondering if it would be possible to force the Test Case tree to show the red ‘x’ when that happens.
We had a developer rename a method recently and it affected the execution of 7 other Test Cases that we didn’t discover until the nightly execution.


Do you want Katalon Studio to do compile-time type checking so that it notifies you of a problem in your test case when you saved the changed keyword?

No, I do not think it is possible.
Katalon Studio uses a dynamically-typed language Groovy, not a statically-typed language Java. See difference of a dynamic language and a static language. Groovy is tolerant for syntactical discrepancies among classes (class A calls a method of class B which is missing) at compile time; which is a designed behavior.

IMHO, it is not a fault of KS. You are supposed to test every test cases by executing them to ensure they are running ok soon after and every time when you (and your developers) changed any part of your code.

1 Like


Using Katalon Studio, you have developed a set of automated UI tests. Then, you might be surprised to hear my opinion; the automated UI tests should be tested as well using some unit-testing frameworks.

Do you and your developers write unit tests for your own custom keywords?

I do unit-testing for my custom keywords in Katalon Studio with JUnit using my custom keyword junit4ks. See the following post of mine:

Also you can use Cucumber testing framework, which is built-in Katalon Studio, for unit-testing your custom keywords.

If you have a set of unit tests for your custom keywords, then your developers would be willing to execute it to ensure your custom keywords work as expected. If you do not have any unit tests for your custom keywords, nobody can be sure if your keywords and test suite work. In a long term without unit tests, it would be very difficult to control the quality/stability of your test suites.

Thanks, I clearly don’t understand groovy enough, I didn’t realize the difference. I was just used to using eclipse/intellij with java only.

That’s a great idea about the unit tests, I’ll be sure to check that out. Thanks!

I was wrong.

Let me change my opinion.

Sophisticated IDE product such as IntelliJ IDEA provides powerful Code inspections for Groovy.

I made a 2 Groovy classes:

  • my.Main
  • my.Greeting

Main calls Greeting.greet(name). It worked.

I removed the my.Greeting class. Then the editor changed in the Main’s view the color of references to the names Greeting and greet.

This experiment proves that IDEA can do authoring time code inspection for Groovy codes.

I just reported what I found.

I do not mean to request Katalon Studio should implement the same level of Code inspection as IDEA. No, I don’t need it. Executing JUnit-based unit tests in Katalon Studio is enough for me.