# Method code too large

**URL:** <https://forum.katalon.com/t/method-code-too-large/9475>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [February 22, 2018, 1:09am UTC](https://forum.katalon.com/t/method-code-too-large/9475 "2018-02-22T01:09:17Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [August 23, 2018, 12:35am UTC](https://forum.katalon.com/t/method-code-too-large/9475/18 "2018-08-23T00:35:52Z")

</div>

A Test Case of Katalon Studio makes a method of a class which runs on Java VM.

The Java Virtual Machine has a [limitation](http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.9.1) that a single method cannot be larger than 64k (65536 bytes) in size. See [Method code too large in Groovy & Grails? - Stack Overflow](https://stackoverflow.com/questions/24256316/method-code-too-large-in-groovy-grails) for more info.

Katalon Studio would never, I suppose, become capable of handling a large test case exceeding the Java VM limitation. If you encounter the “Method code too large!” problem, you have no other choice but shrinking your test case code.

~~I would suggest splitting your large test case into a set of smaller test cases making sure each of them smaller than the JVM limitation. And you add a test case which invokes other worker test cases using [WebUI.callTestCase()](https://docs.katalon.com/display/KD/%5BCommon%5D+Call+Test+Case "Link: https://docs.katalon.com/display/KD/%5BCommon%5D+Call+Test+Case").~~

```auto
[a large test case] >>>>> [caller test case]
                                                -> [callee test case 1]
                                                -> [callee test case 2]
                                                -> [callee test case 3]
                                                -> ...
                                                    smaller codes as many as you want

```

* * *

edited at 8 Jan, 2020

> … splitting your large test case into a set of smaller test cases … (then re-assemble them) using WebUI.callTestCase()

No. It does not help. I found that WebUI.callTestCase() concatenates the code of callee scripts into the caller to form a single large method. If the caller script has 100 lines of script, and the callee script has 400 lines, then at runtime we will have a single method of 100 + 400 = 500 lines. In terms of JVM method size, this approach does not make any effect.

No need to say, a straight forward refactoring would be  
splitting a large Test Case into smaller pieces, and bind them by a Test Suite, if possible.

```auto
[a large test case A] >>>>> [Test Suite X]
                                                -> [test case 1]
                                                -> [test case 2]
                                                -> [test case 3]
                                                -> ...
                                                    smaller codes as many as you want

```

---

_[View the full topic](https://forum.katalon.com/t/method-code-too-large/9475)._
