Script fails with error Java class is too large

Hi,
I have an SAP Fiori business flow which navigates multiple pages to complete the flow. I have recorded the flow using a proxy (excluding HTML resources) that generated 5000+ lines of code including headers. While trying to execute the script, it is failing with an error “Java class is too large”.

I have trouble breaking the class as the flow has a dependency and each request correlated with dynamic values from prior requests.

I tried to split the class with multiple as like below

public class taxreport extends Simulation
{
Headers
}

public class taxreport1 extends taxreport 
{
Part of  code
}

public class taxreport2 extends taxreport1 
{
Part of  code
}

public class taxreport2 extends taxreport1 
{
Part of  code
}

When I execute the code, it lists all four classes and the execution also fails with errors.

Hi @Srini,

Indeed, your reach a limitation of the Java ecosystem.
To divide the code into several classes is the right approach.
But why did you make them all extend one another?

I guess the dynamic value is given into the session…
They are bound by call order, at runtime. No need to have them related more than that.

You should follow our (free access) academy where such refactoring topics are covered.

Cheers!

Thank you @sbrevet
I remember the code refactoring session under the eCommerce module, I will go through it one more time and will try to implement it.

Normaly , header variable is a static variable. Why create a class whose inherits of Simulation for that or an other class?
Even in the Academy Gatling course, that is not used as this.

Use ChainBuilder for separating tests, ScenarioBuilder for organizing the order of tests, setUp fonction for running the tests with time or velocity parameters.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.