Comments (8)
I just now tested the using the same request body and it worked for me
- used the same script and csv file
- script is used in collection settings pre-run scripting
You need to increase the iterations count in run collection view
from thunder-client-support.
@CharlieSnowCode Thanks for the feedback. Currently, it's not possible. I will review it.
Alternatively, you can use scripting to read custom data files at the request level and set variable values.
Could you please try the scripting option and let me know your feedback?
from thunder-client-support.
I'll give it a try, could you help me get started? If each data file has 5 rows of values, how would I iterate through them? Where would the script be, in the PreRun Scripting or a custom filter file? If the file would be loaded by a custom filter, same question - how to iterate over the sets of values?
from thunder-client-support.
- Copy the below script to your folder settings - PreRun Scripting and modify as needed
- change the
filepath
and thevariable name
to your defined name
var fileData = await tc.readFile("thunder-tests/test.csv");
var papaparse = require('papaparse');
var options = { delimiter: ',', quoteChar: '"', escapeChar: '"', header: true };
let csv = papaparse.parse(fileData, options).data;
console.log(csv);
var iteration = tc.info.currentIteration;
var iterationCsvData = csv[iteration];
if(iterationCsvData){
console.log(iterationCsvData);
var name = iterationCsvData["name"];
console.log("name", name);
// set variable using request scope so the value is not saved to active env file
tc.setVar("name", name, "request");
}
sample csv file - test.csv
name,score
mike,444
john,555
from thunder-client-support.
I've attached the (Pre run) script and the .csv I'm using, a snapshot of the (Restful Booker) Request and of the output. It seems like the script sees the file, but the Request is only executed once and none of the values are populated.
preRunScript.txt
BookerDataGood.csv
Output.txt
from thunder-client-support.
Very interesting, I created a Collection and copied the script to it (I was using a folder inside an existing Collection which still doesn't work). Then increased the Iterations to 3 and it worked. Many thinks for your reply.
I would however still request the original feature be implemented, as this solution will have us creating 2 dozen Collections - which can't be executed from the UI all at once. I'm sure they can be from the CLI, but the command would be a large paragraph.
from thunder-client-support.
For advanced use cases we recommend using scriping or cli is the best solution currently.
from thunder-client-support.
Closing this issue as you can achieve the functionality using scripting
from thunder-client-support.
Related Issues (20)
- cannot import nor export environments HOT 4
- Collection disappeared HOT 1
- Oauth says "Saved Successfully" when it fails
- HMAC calculation is not same as POSTMAN HOT 2
- Size, in response page, does not reflect gzip compression
- Cannot Copy, Cut or Paste when you save a large query HOT 2
- Logout from all of my devices HOT 3
- Right click menu broken when the bottom bar's align panel is set to justify HOT 1
- Error "Update to latest version" shown although already updated to latest version (v2.23.1) HOT 5
- CSV file uploaded is not reading in my query . HOT 16
- Dynamic variable syntax in JSON body HOT 2
- tc.loadFromPath missing HOT 1
- Failed to Import: 1 files - thunder-collection-xyxyxyxyxy.json HOT 2
- set-cookie from server supports or not? HOT 5
- setVar inside tests from requests that is run from another request's (parent request) pre-run results in the parent request's getVar getting outdated value HOT 1
- Incorrect execution order of main request pre-run script when pre-request request(s) are specified HOT 5
- V S Code editor thunder client not showing anything on the side bar HOT 1
- Get Request ID HOT 2
- content-type error,application/x-www-form-urlencoded HOT 1
- keeps activating HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thunder-client-support.