I am developing a script that carries out different load tests across multiple services, one service after another, in sequence. The successful response data along the way is critical to simulating the lifecycle of a product from creation to cancellation; service1 returns a piece of information that is required in service2, so on and so forth… In essence, I need to save what is returned from service1 so that VUs in the service2 tests can access and use that data to make successful, unique requests, and continue to do that for the following services. Is it possible to save certain response data and make it accessible to VUs, and continue that for multiple services? Can a database be leveraged to accomplish this somehow without creating a custom compile with an extension? Thank you very much.
Hi GMB, Welcome to the community forum!
It seems to me that you are talking about something like
let resp = http.get(service1); let something = // get it from the resp let resp2 = http.get(service2, // use something here);
In this case you can just use a variable and use it later.
Will that work for you and if not can you expand on why
Sorry for such a lag in response! I have been further familiarizing myself with k6 capabilities, and along with understanding project requirements better, it seems what we will need to do is separately create database entries (that would have otherwise been created by subsequent steps in the flow) and then execute downstream processes in tandem using those entries. It sort of shifts the focus of the question, though. We will export those entries to a file (whether that is a csv or json file, etc…) and pass that in to our script so that we can pull lines of data to build the requests, but… What is the best way to do that when you are dealing with thousands of lines of data? I saw that using execution context variables was discouraged, but I can’t think of another way to do it. Does anyone have any thoughts?
What is the best way to do that when you are dealing with thousands of lines of data? I saw that using execution context variables was discouraged, but I can’t think of another way to do it. Does anyone have any thoughts?