Automating Requests Through Postman - csv

I have ~10,000 records in a csv file that I need to run through postman and check the output it gives.
I was wondering (because I've been doing this manually) if there's a way to import the csv file into postman, and use the rows like variables and just 'scroll' through each result it gives out.
Cheers,
Daniel

This feature exists in Postman runner.
You have to make sure your CSV column's name(s) match the name(s) of your variable(s) in your collection.
You select your CSV file in the "data" part, just above the "start run", and when you run your collection, it will parse your file and replace the variable(s) with the value in the corresponding column and execute the request.
Then it will loop and get the next value and execute, and so on.
It just depends on the content of your CSV file and how you use it in your Postman request.
You shall have a look at those links :
https://www.getpostman.com/docs/postman/collection_runs/working_with_data_files
http://blog.getpostman.com/2014/10/28/using-csv-and-json-files-in-the-postman-collection-runner/
They will give you complete explanation about how it works.
Alex

Related

JMETER - The string value from the CSV file is sent as array to the URL

I have the following API URL someexample/Create?Name=${Name} where through POST method in jmeter I send the value of Name from the CSV file.
In the response body the value of Name is [1,2,3,4] instead of User1.
Does anyone have an idea why the correct value defined in the CSV file is not being passed?
Thanks in advance.
It's impossible to tell what's wrong without seeing:
First 2 lines of your CSV file
Your CSV Data Set Config setup
If you have i.e. test.csv file which looks like:
User1
User2
User3
etc.
You can configure CSV Data Set Config as follows:
And refer the variable as ${Name} where required.
On each iteration each thread (virtual user) will pick up the next line from the file and the JMeter Variable placeholder will be substituted with data from the CSV in the runtime.
Also you can observe all JMeter Variables with their respective values using Debug Sampler and View Results Tree listener combination
More information: Using CSV DATA SET CONFIG

Jitterbit: target CSV-file created with only header although "do not create emtpy files" is checked

In Jitterbit Dataloader 10.37 I want to create CSV-files from Salesforce data but only if the query returns data.
I checked "do not create empty files" on the target type local file but it is still creating a csv just with the header but with no data. I do not want files created with no data in it. It is not an option to not have the header at all in the files - I will need it when there is data from the query.
Any suggestions? What am I missing?
I've seen this happen in situations where the write operation is after a couple of other operations. In that instance a header is written in the first operation, then another header is written in a second operation. The first row is read as the header, the second row (another header) is read as data, and written out.
I always add in a condition where I check if one of the fields equals its name. Something like this, to just skip those rows.
<trans>
if(Id=="Id",
false;,
true;
);
</trans>
The best way to do this is to send your output to a variable array. Then check the variable to see if data is present. So set your target to a global variable. Then add a script after that target and do your validation. To test your script use DEBUGBREAK(); to test and look at your variable content. That way you can see what is going into it.
Then make your condition statement.
if( Length($varailbe)>1,RunOperation("operation:myexport"),"novalue"):

how to run particular http request to multiple times in jmeter?

I've multiple http samples in Test Plan but i want to run only one request for multiple times based on csv data set config and remaining http requests will run once particular sample is complete all the iteration based on csv data set config.
In above image i've 5 http samples and i've csv data set for first request,once first request is run for entire csv data set test data then another samples should run,please provide solution how to perform this type of operation in jmeter.
you can use Loop Control and provide the number of hits you needed.
To go to Loop Control:
Right click on the Thread/ThreadGroup
Click on Add
select the Logic controller
Select the Loop Controller
According to the problem, there is a need to execute a particular request to execute in a loop. The loop could be organized in the following way.
-> Thread Group
-> Loop Controller
-->Particular Request
-> Other Request
The CSV Dataset could be found in Config Element and should contain a path to a particular file with data (e.g. accounts.csv).
Both elements could be located in
Loop controller: Add ->Logic Controller -> Loop Controller
CSV Data Set : Add -> Config Elements -> CSV Data Set Config.
The loop can run for the exact amount of records in a file if
Loop Count is equal to a number of strings in the accounts.csv
Forever, it could be stopped by Test Duration automatically or by Stop button.
The CSV Data Set config should have a path to a file with data.
If a file contains headers, then Variables will be assigned based on column names from first string, otherwise, it is necessary to provide variables names in configuration.
ANSWER: If you use 9 variables and all of them are set as header names in a file, then don't provide them in CSV Data Set Config. They will be created automatically, so you can use all 9 variables through names in your file.
If headers are not provided, set 9 all in a Variable Names field, using comma as separator.
Configure your CSV Data Set Config like:
Reference name: foo
Recycle on EOF: false
Stop thread on EOF: false
Put the CSV Data Set Config under the While Controller and put ${__javaScript("${foo}" != "<EOF>",)} into "Condition" input
Add If Controller under the While Controller and put "${foo}" != "<EOF>" into the "Condition" input
Put your first request as a child of the If Controller
Replace foo with your actual JMeter Variable reference name everywhere in the script.
This way JMeter will loop until there are entries in the CSV file and will proceed with the remaining requests when the end of CSV file will be reached.
See Reading all Values from the CSV and Continue chapter of the Using the While Controller in JMeter article for more detailed information on configuring JMeter for your scenario.
You can verify with only one variable and Rest variable you don't required in If and while controller.

processing multiple files in business objects data services

I am new to the Business Objects Data services.
I have to run a dataflow reading from a file. Filename should be read based on wild chars like Platform. And I want to run the dataflow only if the file exists, if file is not present , it should not error out or should not do anything but it should just move on to the next dataflow or workflow in the job.
I tried below code to check if the file exists as built_in function File_Exists cannot check the file based on wild chars.
*$FILEEXISTSFLAG= exec('/bin/ksh',' "ls xxxxxx/Platform.csv',8);*
My intention is based on the value assigned to $FILEEXISTSFLAG from above code, I will decide whether to execute the data flow or not (if $FILEEXISTSFLAG is null do nothing otherwise execute the data flow ) but its retrieving below output.
*ls: cannot access /xxxxxx/Platform.csv: No such file*
Is there any other way to achieve this?
I was able to solve the above problem by using the index function.
$FILEEXISTSFLAG is containing a value like "ls: cannot access Platform: No such file or directory ". So, I have used the index function as below. So if the output is not null for below index function, it will execute the dataflow, otherwise it will do nothing.
index( $FILEEXISTSFLAG , 'No such file',1)
Thanks,
Phani.

In Jmeter, What would be syntax of parameters in Body Data section of HTTP Request Sampler, if I am using Rest APIs and taking input from CSV files?

I am trying to create 10 users at the same time in Jmeter, using REST APIs.
Test Data i.e. input is taken from CSV files (The details of users like user name, last name , mobile)
For this I have added one thread group,User Defined Variable,HTTP Header Manager, HTTP Request Sampler (which perform successful login into web application), JSON PATH EXTRACTOR ( to extract auth token, which will be used while adding user)
To Add User, I have used one "Loop Controller" - "HTTP Request Sampler" - HTTP Header Manager, CSV Data Set Config.
And to track result, View Results Tree and Aggregate Report.
Please tell me what would be the syntax of parameters which I am passing in "Body Data" section of HTTP Request sampler, so that it can read values from csv files.
Below is the syntax I am using now to add single user.
{
"phoneNo": "9998885551",
"lastName": "john25",
"email": "azp25#gmail.com",
"firstName": "ricky25",
"mobileNo": "9820420420"
}
If your CSV file looks like:
9998885551,john25,azp25#gmail.com,ricky25,9820420420
9998885552,john26,azp26#gmail.com,ricky26,9820420421
....
Configuration should be the following:
Filename: full path to your source .csv file
Variable Names: phone,lastname,email,firstname,mobile
Delimiter: ,
Populate other values according to your test scenario i.e. whether you want test to stop on .csv file end or re-spin or whatever.
And your HTTP Request should look like:
The main point is that variables defined in the CSV Data Set Config need to match the ones in the HTTP Request.
See Using CSV DATA SET CONFIG guide for detailed instructions.
I would also recommend adding the following entry to your HTTP Header Manager:
Name: Content-Type
Value: application/json
elsewise your request will be treated like plain text and may fail.
Also don't forget to disable View Results Tree listener for actual load test run as it consumes a lot of resources and may lead to out-of-memory errors on JMeter side.
Also,if your formparam\ Body data contains multiple parameters like this:
UserName=abc
password=abc123,
Instead of created two columns for userName and password, it can be given in single column like this:
UserName=abc&password=abc123
This way you can loop through multiple\different URL's which takes different numbers of bodydata
E.g.: If URL1 takes only username as body data and URL2 takes Username & password as body data the above will be an easy solution.