-1

I am not sure if this task could be accomplished by Postman looking for suggestions. I would like to dump some data into my database using postman. Currently I have something like this in Postman. It is a post request.That basically creates a single user

{
"user" :    {   
             "first_name": "Alex",   
             "last_name": "bar",
             "username": "alex",
             "email": "alex@gmail.com",
             "password":"..." 
             },

"employee_zip" : 12345
}

currently my db is empty.What I would like to do is basically create multiple users with different values using postman. Currently the only way I can think of doing this in postman is to create requests inside a collection and then run the collection. This method seems very tedious and wrong. I know I could simply use python to create a function that takes these values in as parameters and then does a post call.I wanted to know if there was an easier way to accomplish this task in Postman.

Rajeshwar
  • 11,179
  • 26
  • 86
  • 158
  • have u ever worked with jmeter? @user – Ryuzaki L Jul 13 '18 at 02:03
  • No this is the first time I am hearing about it. Are you suggesting Postman would be the wrong tool for this job ? Seems like it is a load testing software ? Can it also handle REST api testing like Postman ? – Rajeshwar Jul 13 '18 at 02:05
  • i suggest postman for testing response and request, but if you want to do bulk load on server then i prefer Jmeter @Rajeshwar – Ryuzaki L Jul 13 '18 at 02:07
  • Its not going to be bulk but a 30-50 entries. I would assume postman would have something like that – Rajeshwar Jul 13 '18 at 02:08
  • Do you have direct access to this database? If you do, then what would be wrong with just writing a SQL script to populate the database? – Tim Biegeleisen Jul 13 '18 at 02:12
  • i don't think so postman have that part, but i believe you can iterate same request and something like that @Rajeshwar – Ryuzaki L Jul 13 '18 at 02:12
  • check this https://stackoverflow.com/questions/36157105/how-to-make-multiple-requests-at-the-same-time-using-postman @Rajeshwar – Ryuzaki L Jul 13 '18 at 02:12
  • Postman now offers a large array of [Dynamic Variables](https://learning.postman.com/docs/postman/variables-and-environments/variables-list/). They're very helpful for re running Postman queries with new unique data. – Aaron Jun 26 '20 at 03:38

2 Answers2

1

The feature you are looking for is something called database seeding. However, the postman is never meant to do that, but, you can use the postman's javascript editor to call some kind of faker API, then parse the variable from postman's js editor and pass these variables into your request. You can have a small idea here.

Arun Code
  • 1,548
  • 1
  • 13
  • 18
0

If you are doing the manual test, you can just use SQL to load the test data. If you are doing automated testing, postman cannot run interact with the database directly, you will have to have some kind API that might be just for testing purpose.

But if you're free to choose tool, I recently released the first version of pandaria, a new lightweight api testing framework, which supports api testing and also database verification and interaction. have a look here: https://github.com/JakimLi/pandaria

Jakim
  • 1,713
  • 7
  • 20
  • 44