I have a test suite having 10000+ test cases, and as all these test cases run under one suite (Regression Suite), my suite getting crashed always due to very high memory consumption, maybe the size of the testNG object is so big that my machine's memory with 16GB ram is always getting consumed. How can I solve this problem, or what maybe I am doing wrong?

  • Have you tried to play with Xmx VM parameter?
    – Alexey R.
    Commented Oct 16, 2020 at 16:41
  • no not yet, can u please describe how can I do this? Commented Oct 20, 2020 at 13:17
  • You need to let your JVM know how much memory of those 16GB it can use. AFAIK by default starting from Java 8 it can use up to 25% if total amount of memory is big enough. To set the concrete values you need to use corresponding keys when start your java process. stackoverflow.com/a/14763095/8343843
    – Alexey R.
    Commented Nov 6, 2020 at 10:40
  • What is stacktrace you are getting?
    – dzieciou
    Commented Dec 6, 2020 at 11:50

1 Answer 1


Have you tried to implement Parallel execution for such a large testNG file. software testing solutions providing companies always recommend to break the file into bits and then try to execute using multiple threads.

Parallel testing cane be implemented in following ways:

  • Parallel- Single Machine - Multiple Processes
  • Distributed Testing- Multiple Machines - Single Process
  • Parallel Distributed Testing- Multiple Machines - Multiple Processes

Try with this and share your feedback if it works for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.