Stop Iteration Running for multiple Times

Hello Community ,

I have two test which contains a Data Set
1 Test has 5 Data Type(Variable)
it test for A,B,C,D,E
and 2nd Test Test for 2 Data Types(Variables) it Test for A,B

When i run the Collection Runner i’m taking the Highest Number 5 iteration to Test the Collection
my problem is for the 2nd Test also it is testing 5 Times
Can i stop this?
I’m New to Postman.
You answers are very Helpful

Thanks,
Daiva

Can you please clarify?

It sounds like you have a collection with two requests. Requests not tests. The tests are run in the scripting tabs and a request can have multiple tests (or no tests at all). Semantics but an important distinction.

It also sounds like you want run request 1 on every iteration, but request 2 only on certain iterations.

This can be achieved using the skip request feature.

Add an extra column to the data file tell it which requests it should run against.

Then have a pre-request script on request 2 that reads that entry from the data file and skips the request if the name isn’t on the list.

Yes, I have 2 two Requestes
Where i’m using Dataset(Variable values)
Request 1:
“Age”: “{{Age}}”,
var Age = [“20”, “23”, “30”, “40”, “33”];

Request 2:
“Occupation”: “{{Occupation}}”,
var Occupation = [“Student”, “Teacher”];
These both are in same collection
When i run the Collection Req 1 has to run for 5 Feilds and the Req 2 is to run for 2 Time only
So how can i do That

I may use 2 req for seperate collections but i want to do it in only One Colletion.
please let me know how can i do that?

Using the skip request feature that I linked in my earlier response.

You create an extra column in your data file. (or key if using JSON).

For each iteration, you add the request names that should run.

For all iterations, request1 will be in the list.

Request2 will only be in the list for two of the iterations.

You add a pre-request script that will skip the request if the current request name is not in the list of request names that should run.

Can you please give me a sample script for the above mentioned Requirement to work
I’m new to Postman

I can’t as I would have to write one and I don’t have many collection runs left in my free quota.

Being new to Postman doesn’t make any difference.

General etiquette is that you at least try this yourself first and then provide details on any areas that you are struggling with. Providing example requests\responses, screenshots and whatever code you currently have.

I’ve provided the logic that can be used.

If you are new to Postman, you should also head over to the Learning Centre.

Learning Center | Postman Learning Center

I would also recommend the “Postman Training” links under Resources.

image

You can no longer earn badges, but 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.

This will help you learn how to help yourself. Rather than provide you a script that you may not understand which may result in more questions that can most likely be answered by the Learning Centre articles.

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