Is there any way we can test Iteration 1 on Monday and Iteration 2 on Tuesday and so on .
Iteration 1 - run on Monday
Iteration 2 run on Tuesday
Iteration 3- on Wednesday
Iteration 5/Iteration 15 - on Friday
Here’s some information to include when creating your question:
Descriptive Title: Write a title that summarizes the specific problem, this shouldn’t be the same as the full question.
Introduce The Question: Explain how you encountered the problem you’re trying to solve and the steps you’ve taken to resolve the issue.
Additional Data: Include additional data that might help someone reproduce your issue - for example, code, collections, data dumps, console errors, screenshots or gifs. Ensure all code snippets are placed within a code block.
Platform Details: Which Postman App, Web Platform, and Operating System version you are using. You can see this in under Settings → About.
Tags: Add up to 5 tags so people can search for answers to similar questions.
Do NOT include sensitive information like auth tokens or passwords.
The collection runner will run one iteration or your collection for each line in your CSV.
Do you have separate data sets for each day, or is it all in one CSV.
How are you triggering the collection. Manually or through some continuous integration (CI) tool?
I would recommend that you have separate files for each day, and the logic for working out the day and selecting the appropriate file would be in the CI tool.
You would then trigger the collection using the Postman CLI or Newman with the appropriate filename for the day.
You haven’t said how you are triggering the collection.
Manually through the web or desktop applications.
Or using the Postman CLI, or Newman.
Using Newman as an example, you run the collection by calling the Newman executable with command line parameters and one of those parameters is the name and location of the data file.
You can just create separate Windows Scheduled Tasks for each day and configure the command line for each task so that it uses the associated CSV file.
This is assuming that you have separate CSV files for each day/unit.
That won’t work. It has to be separate CSV files for each day\unit.
The Collection Runner will run your entire collection once for each line in your CSV.
Or once per folder, if you provide a folder in the command line options.
You need a way of splitting your CSV file into the separate Units prior to calling the Postman CLI or Newman CLI with the tailored CSV file for that day.
This isn’t that hard to do with PowerShell, but it will be if you’ve never used PowerShell before.
This would be the way I would do this so I don’t have to add any extra code within Postman.
I would use PowerShell to call the Newman command line with the appropriate data file for that day.
I would setup three separate scheduled tasks. One for each day, or add the logic to the PowerShell script so its only one script.
Postman has a skipRequest() feature and a setNextRequest() feature but both of these options would have drawbacks over curating the CSV file before running the Postman Collection.
setNextRequest() only sets the request that will run after the current request and all of the code in the pre-request and post-response scripts has completed. That means if you had a bit of code that works out which Unit and day it is, it will still run the first request in the collection for every line in your CSV file.
skipRequest() may work but you would have to include code in the pre-request script for every request in your collection as it only skips the current request. You would need to have a pre-request script which gets the current day using the inbuilt JavaScript functions and the unit number from the CSV file. If the unit and day don’t match, then skip the current request. You can add this to the pre-request script at the collection level so it applies to every request within the collection.
It will still run all of the iterations but will skip the requests for the non-matching days.