Calling keywords in test cases causes error "Unresolved compilation problem"

Hi.

I am using Windows 10 with Katalon Studio 8.1.
I have noticed that for some time now I regularly receive the following issue.

We have a keyword titled gVar and it has classes such as gVar.Set_PE_Database, which are used in test cases.

For some time now, seemingly at random, I will run a test script and it will generate this error.

2021-07-27 15:52:05.366 INFO c.k.katalon.core.main.TestSuiteExecutor - START Test Suites/PSTD-01
2021-07-27 15:52:05.445 INFO c.k.katalon.core.main.TestSuiteExecutor - hostName = in038 - W0252976.partners.org
2021-07-27 15:52:05.445 INFO c.k.katalon.core.main.TestSuiteExecutor - os = Windows 10 64bit
2021-07-27 15:52:05.446 INFO c.k.katalon.core.main.TestSuiteExecutor - hostAddress = 10.251.215.229
2021-07-27 15:52:05.447 INFO c.k.katalon.core.main.TestSuiteExecutor - katalonVersion = 8.0.1.208
Test Suites/PSTD-01
PSTD-01
GlobalVariableSuiteName set to : PSTD-01
2021-07-27 15:52:05.515 ERROR k.k.c.m.CustomKeywordDelegatingMetaClass - :x: Unresolved compilation problem:

2021-07-27 15:52:05.518 ERROR c.k.k.core.context.internal.TestHooker - :x: com.kms.katalon.core.exception.StepErrorException: java.lang.Error: Unresolved compilation problem:

at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.throwError(CustomKeywordDelegatingMetaClass.java:96)
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:68)
at TestListener.sampleBeforeTestSuite(TestListener.groovy:79)
at TestListener.invokeMethod(TestListener.groovy)
at com.kms.katalon.core.context.internal.TestHooker.invokeMethod(TestHooker.java:111)
at com.kms.katalon.core.context.internal.TestHooker.lambda$3(TestHooker.java:95)
at com.kms.katalon.core.context.internal.TestHooker.invokeContextMethods(TestHooker.java:94)
at com.kms.katalon.core.context.internal.TestListenerCollector.lambda$3(TestListenerCollector.java:88)
at com.kms.katalon.core.context.internal.TestListenerCollector.handleListenerEvent(TestListenerCollector.java:85)
at com.kms.katalon.core.context.internal.ExecutionEventManager.publicEvent(ExecutionEventManager.java:36)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:91)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1627415522379.run(TempTestSuite1627415522379.groovy:39)
Caused by: java.lang.Error: Unresolved compilation problem:

at gVar.GetSysProperty.(GetSysProperty.groovy:1)
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:46)
… 12 more

2021-07-27 15:52:06.546 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2021-07-27 15:52:06.546 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/Helper Test Cases/Set_Vanilla_Database
2021-07-27 15:52:06.754 DEBUG testcase.Set_Vanilla_Database - 1: SndBoxNum = SndBoxNum
2021-07-27 15:52:06.756 DEBUG testcase.Set_Vanilla_Database - 2: crBatPath = “C:\CoreValidation\BatchFiles\PE_CreateDB_param.cmd”
2021-07-27 15:52:06.757 DEBUG testcase.Set_Vanilla_Database - 3: upBatPath = “C:\CoreValidation\BatchFiles\PE_UpgradeDB.cmd”
2021-07-27 15:52:06.758 DEBUG testcase.Set_Vanilla_Database - 4: Create_file = “pe_7_21_blank.zip”
2021-07-27 15:52:06.760 DEBUG testcase.Set_Vanilla_Database - 5: DeployPath = "\Cifs2\datamgt2$\Universal_Deployment\SQL_Deployment.cmd \Cifs2\datamgt2$\Universal_Deployment\sql\packages\pe" + Create_file + " \Cifs2\datamgt2$\Universal_Deployment\sql\PHSSQL854\Sandbox" + SndBoxNum + “\PE.xml”
2021-07-27 15:52:06.773 DEBUG testcase.Set_Vanilla_Database - 6: Upgrade_file = “pe_8.4_upgrade.zip”
2021-07-27 15:52:06.774 DEBUG testcase.Set_Vanilla_Database - 7: UpgradePath = "\Cifs2\datamgt2$\Universal_Deployment\SQL_Deployment.cmd \Cifs2\datamgt2$\Universal_Deployment\sql\packages\pe" + Upgrade_file + "\Cifs2\datamgt2$\Universal_Deployment\sql\PHSSQL854\Sandbox" + SndBoxNum + “\PE.xml”
2021-07-27 15:52:06.776 DEBUG testcase.Set_Vanilla_Database - 8: gVar.Set_PE_Database.Set_PE_DB(crBatPath, upBatPath, DeployPath, UpgradePath)
2021-07-27 15:52:06.785 ERROR k.k.c.m.CustomKeywordDelegatingMetaClass - :x: Unresolved compilation problem:

2021-07-27 15:52:06.787 ERROR c.k.katalon.core.main.TestCaseExecutor - :x: Test Cases/Helper Test Cases/Set_Vanilla_Database FAILED.
> Reason:
**> java.lang.Error: Unresolved compilation problem: **
**> **
> at gVar.Set_PE_Database.(Set_PE_Database.groovy:1)
> at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:46)
> at Set_Vanilla_Database.run(Set_Vanilla_Database:27)
> at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
> at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:398)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:389)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:368)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:360)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:255)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:203)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:152)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:95)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1627415522379.run(TempTestSuite1627415522379.groovy:39)

2021-07-27 15:52:06.793 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/Helper Test Cases/Set_Vanilla_Database
2021-07-27 15:52:06.965 INFO com.kms.katalon.core.util.KeywordUtil - Start generating HTML report folder at: C:\KatalonProjects\Non-PE_Core_2\Reports\20210727_155202\PSTD-01\20210727_155202…
2021-07-27 15:52:06.993 INFO com.kms.katalon.core.util.KeywordUtil - HTML report generated
2021-07-27 15:52:06.994 INFO com.kms.katalon.core.util.KeywordUtil - Start generating CSV report folder at: C:\KatalonProjects\Non-PE_Core_2\Reports\20210727_155202\PSTD-01\20210727_155202…
2021-07-27 15:52:07.016 INFO com.kms.katalon.core.util.KeywordUtil - CSV report generated
2021-07-27 15:52:07.121 INFO c.k.katalon.core.main.TestSuiteExecutor - --------------------
2021-07-27 15:52:07.121 INFO c.k.katalon.core.main.TestSuiteExecutor - END Test Suites/PSTD-01
2021-07-27 15:52:07.122 INFO c.k.katalon.core.main.TestSuiteExecutor - ====================

The “Unresolved compilation problem” error is always with reference to a test script using a class or method under the gVar keyword.

The solution is to go into the Katalon project and delete the bin and Libs folders, and the .classpath and .project, and to reinitialize the katalon project, after which it works fine. But it keeps appearing again and again.

But this may be a bug in Katalon.

Ilya

Does anything show up here?

Description: Errors


Description: Warnings

These are issues I have been meaning to clean up. But it strange that this issue sometimes does and does not appear.

@duyluong @ThanhTo

Any advice guys?

You have 15 errors in “Description: Errors”. These are caused by your coding mistakes, not by Katalon Studio’s problem. You have to fix all of these error in your codes before running your tests. Otherwise your test will never ran successful.

For example, 3rd line

Groovy:Invalid duplicate class definition of class gVar.ExecuteDB : The sources C:\KatalonProject\Non-PE_Core_2\Keywords\gVar\ExecuteQuery.groovy and C:\KatalonP    ...(can not see what follows)

What this message tells?

You have 2 *.groovy files

  • C:\KatalonProject\Non-PE_Core_2\Keywords\gVar\ExecuteQuery.groovy and
  • C:\KatalonP …(can not see what follows)

These files contain the same code fragment:

package gVar

class ExecuteDB {
    ...
}

you need to get rid of the duplication.

1 Like

Thank you. I will do so.

Hello, i am facing the similar issue, the test suit runs absolutely fine on Katalon IDE and one RTE machine, but on another RTE machine it throws below exception…

java.lang.Error: Unresolved compilation problem:

at common.VerifyViaText.<init>(VerifyViaText.groovy:1)
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:46)
at DigitalBanking_SanityLogin.run(DigitalBanking_SanityLogin:105)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:398)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:389)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:368)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:360)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:255)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:203)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:152)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:95)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1627574832036.run(TempTestSuite1627574832036.groovy:39)

The above message tells that you have 2 modules you created:

  • common.VerifyViaText
  • DigitalBanking_SanityLogin

Please share the source code of them.

Also, the above message indicates that common.VeirfyViaText has a “UnsesolvedCompilationProblem” at the line#1. The line#1 would be a package xxxxx statement, but it could be wrong somehow. Please check if you wrote the code right.

Thanks for the reply…below is the code for Keywords. It has been consistently working fine. Then it errored out on the day of deployment and worked it again today. has no clue about the behavior.
this is how it is being called in the test…

String otpcode  = CustomKeywords.'common.VerifyViaText.getOTPDigital'(GlobalVariable.digiserver, GlobalVariable.digidb, GlobalVariable.digidbUser, GlobalVariable.digidbPwd)
package common
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.checkpoint.Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testcase.TestCase
import com.kms.katalon.core.testdata.TestData
//import com.kms.katalon.core.testng.keyword.TestNGBuiltinKeywords as TestNGKW
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
import java.sql.*;
import java.sql.DatabaseMetaData
import java.sql.Connection
import java.sql.DriverManager
import java.sql.ResultSet
import java.sql.Statement
import java.sql.SQLException
import internal.GlobalVariable

public class VerifyViaText {

	@Keyword
	def getOTPP360(String server, String db, String user, String password, String memberNumber){

		Connection con = null;
		Statement stmt = null;
		ResultSet rs = null;
		String OPToken = null;

		try {

			con = DriverManager.getConnection("jdbc:sqlserver://" + server +":1433;databaseName=" + db + ";user=" + user + ";password=" + password );
			String sSql="select TOP (1) Txn_Token from [xxxx_Notification_Log] where Member_Number = " + memberNumber + " and Client Like 'OnlineForms-MemberProfile' and PhoneNumber = '20xxxx975' order by Token_Date_Time desc"
			//String sSql="select TOP (1) Txn_Token from [xxxx_Notification_Log] where Member_Number = " + memberNumber + " and Client liKe 'xxx%' order by Token_Date_Time desc"

			stmt = con.createStatement();
			rs = stmt.executeQuery(sSql);
			Object CountryCode =  null;
			ResultSetMetaData rsmd = rs.getMetaData();
			int columnCount = rsmd.getColumnCount();

			while (rs.next()){
				OPToken = rs.getString("Txn_Token");
				System.out.println("OPToken --" + OPToken);
			}

			return OPToken
		}
		catch (Exception e) {
			e.printStackTrace();
		}

		finally {

			if (rs != null)
				try {
					rs.close();
				} catch (Exception e) {
				}

			if (stmt != null)
				try {
					stmt.close();
				} catch (Exception e) {
				}

			if (con != null)
				try {
					con.close();
				} catch (Exception e) {
				}
		}
	}

	@Keyword
	def getOTPDigital(String server, String db, String user, String password){

		Connection con = null;
		Statement stmt = null;
		ResultSet rs = null;
		String OPToken = null;

		try {

			con = DriverManager.getConnection("jdbc:sqlserver://" + server +":1433;databaseName=" + db + ";user=" + user + ";password=" + password );
			//String sSql="select TOP (1) Passcode from [xxxxLive].[dbo].[DbAccessPasscode] where ContactPoint='Text/201-xxxxx75' order by InsertAt desc "
			String sSql="SELECT TOP 1 Passcode FROM Dxxxcessxxxscode where ContactPoint = 'Text/201xxxx75/1 ' order by InsertAt desc"
			stmt = con.createStatement();
			rs = stmt.executeQuery(sSql);
			Object CountryCode =  null;
			ResultSetMetaData rsmd = rs.getMetaData();
			int columnCount = rsmd.getColumnCount();

			while (rs.next()){
				OPToken = rs.getString("Passcode");
				System.out.println("Passcode --" + OPToken);
			}

			return OPToken
		}
		catch (Exception e) {
			e.printStackTrace();
		}

		finally {

			if (rs != null)
				try {
					rs.close();
				} catch (Exception e) {
				}

			if (stmt != null)
				try {
					stmt.close();
				} catch (Exception e) {
				}

			if (con != null)
				try {
					con.close();
				} catch (Exception e) {
				}
		}
	}
}

I feel the package name common is questionable.

package common

It looks too generic. I guess that your deployment environment somehow dislikes the package name common, though I have no concrete idea why. How about renaming the package to make it more unique so that you take less risk of duplication. For example, common → manojpuri.common.