Method code too large

Worth Repeating:

Web Recorder would generate a big code. That’s OK. That’s the way it
works. But one thing, I always regard the generated code as a material,
premature draft, or sketch which requires careful refinement. I would
read the generated code, understand it, and find boundary of lines by
semantics, then I would split it into a set of code snippets of
manageable size.

I am rather afraid that those who are new to
Katalon Studio may expect the test case code generated by Web Recorder
is near to completion. But I swear, code generation is just a start. You
have long way to go for rethink and rewriting codes.

1 Like

I got the same error in 5.7.0. But all scripts worked fine in 5.2.x.

HYN said:

I got the same error in 5.7.0. But all scripts worked fine in 5.2.x.

They stopped working after version 5.3.1 if i recall correctly.

You can read here:

I worked around.
It worked well when splitting test suites and add all in test suite collection on Katalon 5.7.0.

Im experiencing this and I dont have 500 lines…more like 400, which is really not alot, especially when you write test by hand (not record). Nevertheless, it seems we either learn the keywords and custom methods or else we are SOL with our scripts lol… Not preferred at all, but if this is the case, the tutorial should at least be much much more comprehensible and easy to apply to our own scripts (creating, implementing, using Keyword, etc).

I am getting the same error for API testing for a CSV file that has over 8K lines of records. How can I implement this method for API. What is a caller test case for a large test case and how the worker test cases can be implemented. Please help getting this understand. Appreciate your help.

We need to understand your problem first. Please share your test case code and the log, and preferably you CSV file.

Thank you for the quick response.

Here is the link for the code and the csv file is attached. (47.6 KB)


I read your test case code. Your code seems to have nothing related to the csv file. I found no fragment which reads the csv file. I am confused.

Could you share the execution log with error messages?

I have used the json payload file wherein the payload has the variables to fetch the data from csv. The CSV files are uploaded in Data Files section of Katalon Studio.

I have then created the Test Suite and added Data File to it.

Your test seems to be complexed enough. I do not understand it.

Here is the log message -

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during class generation: Method code too large!

java.lang.RuntimeException: Method code too large!
at groovyjarjarasm.asm.MethodWriter.a(Unknown Source)
at groovyjarjarasm.asm.ClassWriter.toByteArray(Unknown Source)
at org.codehaus.groovy.control.CompilationUnit$
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(
at org.codehaus.groovy.control.CompilationUnit.compile(
at groovy.lang.GroovyClassLoader.doParseClass(
at groovy.lang.GroovyClassLoader.parseClass(
at groovy.lang.GroovyShell.parseClass(
at groovy.ui.GroovyMain.processOnce(
at groovy.ui.GroovyMain.process(
at groovy.ui.GroovyMain.processArgs(
at groovy.ui.GroovyMain.main(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(

1 error

Picked up _JAVA_OPTIONS: -Xmx2048M

Could you share the "C:\\Users\\sp\\Desktop\\ATS\\logUnique.json" file which is refered by the test case script?

Please find the link below for JSON -

Could you take screenshot of the Test Object 'events/EventsLogUnique' and share it?

I do not understand what you mean here. Could you elaborate it?

Please find the screen capture for the same.

As you can see, the stack trace message does not tell you which portion of your test scripts is causing the RuntimeException.

I presume the test case is NOT causing java.lang.RuntimeException: Method code too large!. I think so because your test case code at has nothing to do with the Data File . Possibly you have other script which might be the real cause of the RuntimeException. Please check your code and identify what is causing the exception.

I could reproduce Method code too large! exception on my side. I have created a project in GitHub, with which you can reproduce this incident.


Please read the Document “Data-driven testing approach with Katalon Studio”

The document introduces two methods of Data-driven Tests Execution, that is:


I believe you followed the method A. I am sure that the A method generates a single test suite script which contains a very long literal which represents whole data in the given CSV file. This would cause Method code too large! exception.

Please try the method B as an alternative. The method B tells you to code for loop over the Data file lines. The for loop would enable you to avoid Method code too large! exception.