I was looking for ways to debug code written in k6. 1 way I found was using k6 run --http-debug but this is more like displaying the output and not similar to the way you will debug the code.
Does anyone has any other recommendation around this?
I was looking for ways to debug code written in k6. 1 way I found was using k6 run --http-debug but this is more like displaying the output and not similar to the way you will debug the code.
Does anyone has any other recommendation around this?
Hi @anshulgoel2,
There is currently no debugging capabilities with k6.
K6 is based on JS VM called goja which also does not have debugging abilities.
An experiment was made around 2 years ago to add both, and while some success was definitely observed the work was very:
At this point the project has been archived.
My experience shows that it is rare that just logging stuff doesn’t help enough and when it doesn’t the usual problem is that the problem happens under load.
Is there a particular problem you are facing?
Hi @anshulgoel2
k6 still doesn’t have its own debugger. However, we can try running a k6 script in Node.js and utilize its debugger. There is a k6-debug-api npm module that implement most of the major k6 core api (including browser one). And there is a k6 plugin for IntelliJ platform that can launch k6 script via Node.js and start the debugger. This way you get all the functionality of a full-fledged debugger, including step-by-step execution and breakpoints. So if you are on IDEA or Webstorm
or any other IntelliJ IDE, you are welcome to give it a try.
Watch a video overview of the debugger: https://youtu.be/3_Yn5FZXXzQ