# Multiple tests with different data on the same POST request

**URL:** <https://community.postman.com/t/multiple-tests-with-different-data-on-the-same-post-request/61930>\
**Category:** Help Hub\
**Tags:** variables, testing\
**Created:** [June 6, 2024, 6:13pm UTC](https://community.postman.com/t/multiple-tests-with-different-data-on-the-same-post-request/61930 "2024-06-06T18:13:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![etoilexxx](https://avatars.discourse-cdn.com/v4/letter/e/e68b1a/32.png) [@etoilexxx](https://community.postman.com/u/etoilexxx)\
**Post date:** [June 6, 2024, 6:13pm UTC](https://community.postman.com/t/multiple-tests-with-different-data-on-the-same-post-request/61930/1 "2024-06-06T18:13:10Z")

</div>

Hi,  
I have a json body with multiple variables that I’d like to update dynamically and run each test on it. I want to avoid having to create multiple POSTs for each scenario.  
Body:  
“Category”: “{{Organization}}”,  
“Matter”: {{Matter}},  
“WorkOffice”: “{{WorkOffice}}”,  
“BillOffice”:{{BillOffice}}

Test1:  
pm.environment.set(“Organization”, “Organization1”);  
pm.environment.set(“Matter”, 0001);  
…  
let responseData=pm.response.json();  
pm.test(“NOTAXOUT”, function () {  
pm.expect(responseData.GroupCode).to.equal(“NOTAXOUT”);  
});

Test2:  
pm.environment.set(“Organization”, “Organization2”);  
pm.environment.set(“Matter”, 0002);  
…  
let responseData=pm.response.json();  
pm.test(“5%”, function () {  
pm.expect(responseData.GroupCode).to.equal(“5.00”);  
});

Thanks,

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [June 7, 2024, 12:12pm UTC](https://community.postman.com/t/multiple-tests-with-different-data-on-the-same-post-request/61930/2 "2024-06-07T12:12:49Z")

</div>

This type of activity is covered in the Postman Learning Centre.

If you are new to Postman, then I would suggest a visit to the Learning Centre.

[Overview | Postman Learning Center](https://learning.postman.com/docs/introduction/overview/)

Including the Postman Training links under “Other Resources”.

![image](https://us1.discourse-cdn.com/getpostman/original/3X/3/b/3b763d56d66445f4c34eeb66c64631335559a741.png)

I would recommend the “Galaxy APIs 101” course first as it gets you used to the application features.

Then the “Galaxy Testing and Automation” course which teaches you how to assert the responses. It includes using variables and basic examples of the collection runner\data files.

Further information on using data files can be found here.

[Run collections using imported data | Postman Learning Center](https://learning.postman.com/docs/collections/running-collections/working-with-data-files/)

[Using CSV and JSON Data Files in the Postman Collection Runner | Postman Blog](https://blog.postman.com/using-csv-and-json-files-in-the-postman-collection-runner/)

The data you want to set, and the tests are the the same for both requests with the only difference being the values, so using a data file should achieve your goal.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [July 7, 2024, 12:12pm UTC](https://community.postman.com/t/multiple-tests-with-different-data-on-the-same-post-request/61930/3 "2024-07-07T12:12:51Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
