# Fetch Pass/fail Count for each request of collection

**URL:** <https://community.postman.com/t/fetch-pass-fail-count-for-each-request-of-collection/39877>\
**Category:** Help Hub\
**Tags:** tests, collections\
**Created:** [October 8, 2022, 3:49am UTC](https://community.postman.com/t/fetch-pass-fail-count-for-each-request-of-collection/39877 "2022-10-08T03:49:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamza.yawaruddin](https://avatars.discourse-cdn.com/v4/letter/h/3be4f8/32.png) [@hamza.yawaruddin](https://community.postman.com/u/hamza.yawaruddin)\
**Post date:** [October 8, 2022, 3:49am UTC](https://community.postman.com/t/fetch-pass-fail-count-for-each-request-of-collection/39877/1 "2022-10-08T03:49:44Z")

</div>

I have a collection of more than 20 requests. _ **Each request contains several tests** _. I want to fetch the **total number of failed and passed requests** and store it in an environment variable.

**My condition for a failed request: IF any test of a particular request fails, the request will be marked as failed.**

**My condition for passing a test: IF all tests for a request pass, the request will be marked pass.**

can anyone share what should be my postman script(code) for this?

---

<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:** [December 12, 2024, 12:52pm UTC](https://community.postman.com/t/fetch-pass-fail-count-for-each-request-of-collection/39877/2 "2024-12-12T12:52:18Z")

</div>

Closed on December 12, 2024, 12:52pm UTC

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