Need to execute the second scenario with data produced by first scenario

hi,
i have js file where it needs to execute two scenarios …
when the 1st scenario execution is done it produces data which can be in json/csv file, where this file will be as an input to execute 2nd scenario

Is there any way for the above case to work …?

Welcome to the forum! :tada:

Unfortunately, there currently isn’t a way for two VUs to share information between them, much less a way to share information between two different scenarios. VUs also can’t write files, and you can read files only in the init context… The only way to achieve something like what you want at the moment is through an external service (e.g. a simple REST API that VUs in the first scenario call to store the data and VUs in the second scenario call to read it) or an xk6 extension (blog post).

Similar question asked before: Share data between two scenarios in K6

thanks ned,
Are there any k6 extension available for this:
-such as writefile in local system…etc…?

Hey, tarun

here it is, extension which allows VU’s to write to local files.

1 Like

hi, we are using k6 operator and using the volume mounts as scripts, k6-sample-xxxx pod was able to right the file in home/k6 but not able to write the folder in mentioned path

and in the logs it shows permission denied