Method Code Too Large Issue

We have encountered a very strange problem every time which is “Method code too large”. In which version will you resolve this? When test steps line become greater than 500 then this issue arise. Kindly resolve this in next version we will be grateful. Actually it is very annoying to divide long code in multiple scripts.

2 Likes

@saad i don’t think it is possible to fix this, unless rewriting it completely on a different language.
this issue it is caused by the JVM limitation, search the forum regarding this and you will find relevant topics on it.
i will suggest to better reconsider your testcases aproach and split the code in sub-cases
i agree … it’s annoying. but this is one of the java darksides.

@ThanhTo @devalex88 perhaps it’s time to review the docs and add a section with ‘known issues/limitations’ and/or ‘best practices’ into the intro part?

As I understand it, the issue is the (hidden) Script Class run method <- your test case steps actually “live” inside the run method.

You don’t need to split the test case into a bunch of sub-tests. You can do the “split” inside the Test Case.

Picture this as a lengthy Test Case:

// Step 1
// Step 2
// Step 3
// ...
// Step 1000

Now do this:

void part_1() {
  // Step 1
  // Step 2
  // Step 3
  // ...
  // Step 100
}

void part_2() {
  // Step 101
  // Step 102
  // Step 103
  // ...
  // Step 200
}
// keep going until all steps are incorporated. Then...

// call part 1
part_1()

// call part 2
part_2()

// ...

// call part 50
part_50()

// etc ...
3 Likes