1

I want create api test to upload large file (~4G), but saw

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

And multipart file file = {read: '', filename: '', contentType: ''}

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

cuhavp
  • 49
  • 5

1 Answers1

0

You can try increasing the JVM heap size: https://stackoverflow.com/a/6452812/143475

but otherwise, Karate is not designed for very large files. if this is a negative test scenario, I would personally use a command line program like cURL or even the Apache HTTP client directly, and use a stream so that you don't have memory issues.

Note that it is easy to call Java code from Karate: https://twitter.com/KarateDSL/status/1128170638223364097

And it is easy to invoke a command-line program from Karate: https://stackoverflow.com/a/53427234/143475

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248