Hi.
I am new to K6.
During the POC I am doing for my company, I found k6 a lovely framework to work with.
One major blocker to using this framework is the lack of very basic load test features, such as data sharing between scenarios.
Am I missing something, or is this really so hard to do with the k6?
How do you test a DELETE route of your microservice, for example? I want to define the CREATE step and then pass the created entity’s IDs to the DELETE step.
I see different approaches to do this, but most of them look like a hack for the built-in behavior of the k6.
Hi @olegtlvil , welcome to the community forum!
- I would use an extension for sharing ids between scenarios, e.g- this one: GitHub - oleiade/xk6-kv: A key-value store extension for k6
- Or create the entities in the setup function, and pass it to the test function with the data variable. Test lifecycle | Grafana k6 documentation
I hope this helps
1 Like
Hi @olegtlvil
Welcome to the community forum
Apart from what @bandorko mentioned, the usual approach, if you want to include the create and delete operations in the load test, is to run them on the same VU. See the API CRUD example in the docs.
And you’ve probably already checked Share data between two scenarios in K6 - #2 by mstoykov
I hope this helps
2 Likes