Star import statement.* in a test case is regarded as error

I have made a demo project where you can reproduce the problem:

Please clone this project with tag 1.0


Problem

Katalon Studio seems not accepting star import statement
import packageName.*
in a test case.

I created a test case Test Cases/StarImportProblemReport

import junittutorial.*

CustomKeywords.'com.kazurayam.ksbackyard.junit.JUnitCustomKeywords.runWithJUnitRunner'(CalculatorTest.class)

CustomKeywords.'com.kazurayam.ksbackyard.junit.JUnitCustomKeywords.runWithJUnitRunner'(GreeterTest.class)

When I ran, I got error:


Error dialog says:

There are errors in the script. Please fix before executing.

What I investigated

When I change the test case as follows, it ran successful.

import junittutorial.Calculatortest
import junittutorial.GreeterTest

CustomKeywords.'com.kazurayam.ksbackyard.junit.JUnitCustomKeywords.runWithJUnitRunner'(CalculatorTest.class)

CustomKeywords.'com.kazurayam.ksbackyard.junit.JUnitCustomKeywords.runWithJUnitRunner'(GreeterTest.class)
1 Like

In script mode, I edited a test case scritp. I commented out indivisual import statements, and add a star import statement.

/*
import com.kazurayam.ksbackyard.AssertTest
import com.kazurayam.ksbackyard.ImageCollectionDifferTest
import com.kazurayam.ksbackyard.ImageDifferenceTest
import com.kazurayam.ksbackyard.RunConfigurationWrapperTest
import com.kazurayam.ksbackyard.QuietBrowserTest
import com.kazurayam.ksbackyard.ScreenshotDriverTest
import com.kazurayam.ksbackyard.ScreenshotDriverCompareImagesTest
import com.kazurayam.ksbackyard.TestObjectSupportTest
import com.kazurayam.ksbackyard.URLParserTest
import com.kazurayam.ksbackyard.VersionTest
*/
import com.kazurayam.ksbackyard.*

CustomKeywords.'com.kazurayam.ksbackyard.junit.JUnitCustomKeywords.runWithJUnitRunner'(AssertTest.class)
CustomKeywords.'com.kazurayam.ksbackyard.junit.JUnitCustomKeywords.runWithJUnitRunner'(ImageCollectionDifferTest.class)
CustomKeywords.'com.kazurayam.ksbackyard.junit.JUnitCustomKeywords.runWithJUnitRunner'(ImageDifferenceTest.class)
CustomKeywords.'com.kazurayam.ksbackyard.junit.JUnitCustomKeywords.runWithJUnitRunner'(QuietBrowserTest.class)
CustomKeywords.'com.kazurayam.ksbackyard.junit.JUnitCustomKeywords.runWithJUnitRunner'(RunConfigurationWrapperTest.class)
CustomKeywords.'com.kazurayam.ksbackyard.junit.JUnitCustomKeywords.runWithJUnitRunner'(ScreenshotDriverTest.class)
CustomKeywords.'com.kazurayam.ksbackyard.junit.JUnitCustomKeywords.runWithJUnitRunner'(ScreenshotDriverCompareImagesTest.class)
CustomKeywords.'com.kazurayam.ksbackyard.junit.JUnitCustomKeywords.runWithJUnitRunner'(TestObjectSupportTest.class)
CustomKeywords.'com.kazurayam.ksbackyard.junit.JUnitCustomKeywords.runWithJUnitRunner'(URLParserTest.class)
CustomKeywords.'com.kazurayam.ksbackyard.junit.JUnitCustomKeywords.runWithJUnitRunner'(VersionTest.class)

When I tried to save it, I got the following error dialog.

There are errors in the script. Please fix them before switching to manual mode.

A new clue is given here: manual mode

What I guess: the Manual mode has some dependencies on entries in the CLASSPATH. The Manual mode depends on the class binaries of Custom Keywords, but it does not suppose to be dependent on the class binaries generated by *.groovy files located in the Includes/scripts/groovy. Therefore the Manual mode can not search for binaries of com.kazurayam.ksbackyard.* which are located in the the Includes/scripts/groovy.

I presume Katalon GUI, especiall the Test Case editor of Manual mode, should be reviewed to cooperate with the build-path Include/scripts/groovy.

2 Likes

Hi @kazurayam,
Please download the latest version of Katalon Studio and try again.

1 Like

I was having this same issue in version 7.0.1, but it appears to have been resolved by at least version 7.2.1

Thanks for the update reminder, @huynguyen

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.