# Implementing Priority-Based Execution Strategy in Postman

**URL:** <https://community.postman.com/t/implementing-priority-based-execution-strategy-in-postman/79957>\
**Category:** Help Hub\
**Tags:** tests, automation, collections\
**Created:** [May 14, 2025, 4:49am UTC](https://community.postman.com/t/implementing-priority-based-execution-strategy-in-postman/79957 "2025-05-14T04:49:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gourish-mahale](https://avatars.discourse-cdn.com/v4/letter/g/ea5d25/32.png) [@gourish-mahale](https://community.postman.com/u/gourish-mahale)\
**Post date:** [May 14, 2025, 4:49am UTC](https://community.postman.com/t/implementing-priority-based-execution-strategy-in-postman/79957/1 "2025-05-14T04:49:14Z")

</div>

Hi everyone,

I’m currently working on implementing a **priority-based execution strategy** for API automation in Postman. The goal is to selectively execute requests from a large collection (e.g., 5000 requests) based on their criticality.

### **Request Naming Convention**

Each request in the collection is named based on its priority:

- `CRITICAL - Login API`
- `MEDIUM - Balance Check API`
- `LOW - Fetch Profile`

### **Environment Variable for Execution Control**

| Key | Value Examples |
| --- | --- |
| runPriority | CRITICAL / MEDIUM,CRITICAL / LOW / ALL |

- `ALL` – run all tests
- `CRITICAL` – run only critical tests
- `MEDIUM,CRITICAL` – run both medium and critical
- `LOW` – run only low priority tests

Pre-request Script (Used in Every Request)  
let runPriority = pm.environment.get(‘runPriority’);  
console.log(“Run Priority:”, runPriority);  
console.log(“Request Name:”, pm.info.requestName);

// Skip the request if it doesn’t match the desired priority  
if (runPriority !== ‘ALL’ && !runPriority.split(‘,’).some(p =\> pm.info.requestName.includes(p.trim()))) {  
pm.execution.skipRequest();  
}

### **Running with Newman (CLI)**

To run **all** tests:

newman run priority\_collection.json --env-var runPriority=ALL

To run only **CRITICAL** tests:

newman run priority\_collection.json --env-var runPriority=CRITICAL

### **Issue I’m Facing**

When a request is skipped using `pm.execution.skipRequest()`, it still appears as **passed** in the Allure report, which creates confusion in the test summary.

### **Looking for Suggestions**

If anyone has implemented a similar strategy or knows a better approach to handle **priority-based execution** and reporting (especially with Allure), I’d really appreciate your insights or suggestions.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![jecorde](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/jecorde/32/14048_2.png) [@jecorde](https://community.postman.com/u/jecorde)\
**Post date:** [May 16, 2025, 3:49pm UTC](https://community.postman.com/t/implementing-priority-based-execution-strategy-in-postman/79957/2 "2025-05-16T15:49:24Z")

</div>

@gourish-mahale  
Thank you for your post.  
This is an interesting priority based approach.

I believe whether all requests are put on scenarios the pm.execution.skipRequest() shall operate.

Unless all requests are not put on divers scenarios, you may encounter that error.

Again, thank you for your post.
