Need help with StresStimulus? Start here.
Saving test data to csv
Unregistered User Posts: 514
1/14/2019
|
Today while working with StresStimulus we had a requirement where we need to save response from an API call to data set so it can be used by next test case. For example, say, we have two test cases where in first we create an object (consider this test case to take hours) and API response gives us JSON with a lot of keys, one of them being ID. Then in second test case we need to consume the same object ID instead of static csv dataset. What would be the best approach here using StresStimulus? We can add data pool to second testcase using CSV. By any means, can update same csv from first test execution?
|
|
0
link
|
George @StresStimulus Administrator Posts: 568
1/18/2019
|
Saving specific data from a response to disk is a custom requirement that can be implemented programmatically using StresStimulus extensibility. Specifically, you would need to develop a custom component that parses the JSON responses and save data to the CSV file. Custom components development described here http://support.stresstimulus.com/display/doc50/Creating+External+Components Developing a component requires some C# programming skills. An example showing how to save a response of a session with a specific URL is here http://support.stresstimulus.com/display/doc50/Save+Response+Example This code will run on every iteration to process that response. You would need to add code that parses the response and only saves the IDs. To write the IDs to the same file, you can use a StreamWriter and setting the append flag to true. The second test case should use this file as a dataset. You can import the resulting file. Alternatively, to import automatically, use the file name <folder>\<name>.csv where • <folder> is the folder of the test with the second test case • <name> is the name of the dataset
|
|
0
link
|
Copyright © 2025 Stimulus Technology