Test Overview
This test checks that requests in Postman are properly organized into folders and collections. It verifies that organizing requests helps find and run tests faster, improving workflow efficiency.
This test checks that requests in Postman are properly organized into folders and collections. It verifies that organizing requests helps find and run tests faster, improving workflow efficiency.
import unittest from postman_api import PostmanClient class TestPostmanRequestOrganization(unittest.TestCase): def setUp(self): self.client = PostmanClient(api_key='dummy_api_key') self.collection_id = '12345' def test_requests_organized_in_folders(self): # Fetch collection details collection = self.client.get_collection(self.collection_id) # Check if folders exist folders = [item for item in collection['items'] if item['type'] == 'folder'] self.assertTrue(len(folders) > 0, 'No folders found in collection') # Check requests inside folders for folder in folders: self.assertTrue(len(folder['items']) > 0, f'Folder {folder["name"]} is empty') def test_can_find_request_quickly(self): # Search for a request by name request_name = 'Login API' request = self.client.find_request(self.collection_id, request_name) self.assertIsNotNone(request, f'Request {request_name} not found') if __name__ == "__main__": unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test framework initialized, PostmanClient ready | - | PASS |
| 2 | Fetch collection details using Postman API | Collection data with folders and requests retrieved | Verify collection data is not empty | PASS |
| 3 | Check if folders exist in collection | Folders list extracted from collection | Assert folders list length > 0 | PASS |
| 4 | Check each folder has requests inside | Iterate folders and check items | Assert each folder's items list length > 0 | PASS |
| 5 | Search for a specific request by name | Request search performed in collection | Assert request found is not None | PASS |
| 6 | Test ends with all assertions passed | All checks successful, workflow improved by organization | - | PASS |