Hello, when I try to run test scripts or suites, I get this error showing up in the console fairly often since upgrading to Katalon Studio 8.x. I’m not sure what could be causing this. It’s not consistent. I know this.
Caught: java.lang.ClassFormatError: Truncated class file
java.lang.ClassFormatError: Truncated class file
at com.kms.katalon.core.main.TestCaseMain.modifyCustomKeywordsClassAtRunTime(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.beforeStart(TestCaseMain.java:62)
at com.kms.katalon.core.main.TestCaseMain$beforeStart.call(Unknown Source)
at TempTestCase1638561942208.run(TempTestCase1638561942208.groovy:23)
I’m now getting this error as well. I’m using KS 8.2 (build 208). Sometimes it work but not really sure what happened. Only happens when doing the test suite. Seems fine when doing test case. Is there a change when doing iteration in data files?
@kazurayam Please find below, the steps to reproduce in V8.2
Firstly create a Custom Keyword as below. CustomKeywords.‘util.Launch.test’() Note: I have few application in my organization which work only in IE browser, but the integration web apps works in modern browser. So I am using this keyword to handle the scenario.
Ensure your default browser is other than IE browser.
To reproduce this issue. Call the CustomKeywords.‘util.Launch.test’() in Testcase. The very first execution works without issue. When you rerun the same testcase, you get the error as mentioned in the thread.
package util
import org.openqa.selenium.WebDriver
import org.openqa.selenium.ie.InternetExplorerDriver
import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.configuration.RunConfiguration
import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
/**
irrespective of the browser selected during execution, the below keyword opens only in IE browser.
*/
public class Launch {
@Keyword
public static void test() {
String path = RunConfiguration.getProjectDir() + "/driver/IEDriverServer.exe"
System.setProperty('webdriver.ie.driver', path)
WebDriver driver = new InternetExplorerDriver()
DriverFactory.changeWebDriver(driver)
WebUI.navigateToUrl('https://www.google.co.in/')
}
}
The “ java.lang.ClassFormatError: Truncated class file ” Exception is raised by com.kms.katalon.core.main.TestCaseMain class at modifyCustomKeywordClassAtRunTime() method because the class file of a Custom Keyword is corrupted (possibly empty). Why? Because of the change you made for performance improvement at v8.2.0, I suppose.