[PR #5557] Introduce iterations & data feed (CSV/JSON) to address #5324, #5163 #5260

Open
opened 2026-03-17 02:43:23 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5557
Author: @Manohar-ford
Created: 11/4/2025
Status: 🔄 Open

Base: mainHead: update-2025.9.0


📝 Commits (10+)

  • b630b1c feat: add support for iterations and validation in collection runner
  • 86d4259 feat: add dataset support for collection runner with CSV/JSON file upload
  • 55d0a94 Merge branch 'hoppscotch:main' into update-2025.9.0
  • b35401a Update packages/hoppscotch-common/locales/en.json
  • a9f6040 Update packages/hoppscotch-common/src/components/http/test/RunnerModal.vue
  • e189281 Update packages/hoppscotch-common/src/helpers/import-export/dataset/parser.ts
  • f1c92a9 Update packages/hoppscotch-common/src/components/http/test/RunnerModal.vue
  • d431e84 Update packages/hoppscotch-common/src/helpers/RequestRunner.ts
  • 6331761 Update packages/hoppscotch-common/src/components/http/test/RunnerModal.vue
  • 394069d Merge branch 'main' into update-2025.9.0

📊 Changes

6 files changed (+616 additions, -66 deletions)

View changed files

📝 packages/hoppscotch-common/locales/en.json (+16 -0)
📝 packages/hoppscotch-common/src/components/http/test/RunnerModal.vue (+319 -6)
📝 packages/hoppscotch-common/src/helpers/RequestRunner.ts (+44 -10)
packages/hoppscotch-common/src/helpers/import-export/dataset/parser.ts (+70 -0)
📝 packages/hoppscotch-common/src/helpers/rest/document.ts (+7 -0)
📝 packages/hoppscotch-common/src/services/test-runner/test-runner.service.ts (+160 -50)

📄 Description

Screenshot 2025-11-04 102316 Screenshot 2025-11-04 102339 Screenshot 2025-11-04 102358

Closes #5324, Closes #5163

This Pull Request introduces significant enhancements to the Hoppscotch Collection Runner, enabling users to execute collections with simple iterations and drive request parameters using external data files. This allows for robust data-driven testing and automation of repetitive tasks, directly addressing user demands for more powerful collection execution capabilities.

What's changed

This PR implements two major features within the Collection Runner: Simple Iteration and Data Feed (CSV/JSON).

  • Collection Runner - Simple Iteration:

    • A new input field has been added to the Collection Runner UI, allowing users to specify a fixed number of times a collection (or selected requests within it) should be executed.
    • The runner will now loop through the entire collection N times, providing a straightforward way to repeat tests or actions.
    • Each iteration will run with a fresh state, allowing for consistent testing across multiple runs.
  • Collection Runner - Data Feed (CSV/JSON):

    • Users can now upload external data files (CSV or JSON format) to drive variables within their requests during collection runs.
    • A new section in the Collection Runner UI allows for selecting and previewing the uploaded data file.
    • For each row in the data file (or each object in a JSON array), a new iteration of the collection is executed.
    • Data from the current row/object is automatically injected as environment variables for that specific iteration. For example, a CSV column username would be accessible as {{username}} in requests during that iteration.
    • This enables dynamic population of request URLs, headers, body, and query parameters, facilitating data-driven testing scenarios.
    • Robust parsing for both CSV and JSON formats is implemented, with clear feedback for malformed files.
  • Integration and UI/UX:

    • The Collection Runner interface has been updated to include controls for both iteration count and data file upload.
    • The execution logic of the Collection Runner has been refactored to manage the iteration loop and variable injection from data feeds.
    • Improved feedback mechanisms during the run to indicate current iteration number and data context.

Notes to reviewers

  • Motivation: This feature directly responds to the community's need for advanced testing capabilities, as highlighted in issues #5324 and #5163. It allows Hoppscotch to compete more effectively with other API clients in terms of automated testing and data-driven workflows.
  • Testing Strategy:
    • Manual Testing: Extensive manual testing was performed to cover:
      • Running collections with a specified number of iterations (e.g., 1, 5, 10).
      • Uploading valid CSV and JSON files, ensuring correct variable injection into requests.
      • Testing with various request types (GET, POST, PUT) and variable locations (URL, headers, body).
      • Verifying error handling for malformed data files or missing variables.
      • Confirming that environments are correctly handled per iteration.
    • Unit/Integration Tests: Relevant unit and integration tests have been added/updated for the new iteration and data parsing logic.
  • Edge Cases Considered:
    • Empty data files: Handled gracefully, resulting in zero iterations or an appropriate error message.
    • Missing variables in data: Variables not found in the data file will fall back to existing environment/global variables or remain unresolved, consistent with current Hoppscotch behavior.
    • Large data files: Performance considerations were made for parsing, though extremely large files might still impact initial load time.
    • Data type handling: All data from CSV/JSON is treated as strings for variable substitution, allowing users to perform type conversions within their request scripts if needed.
  • Future Enhancements (Out of Scope for this PR):
    • Advanced reporting for data-driven runs (e.g., pass/fail statistics per iteration).
    • Support for additional data formats (e.g., Excel).
    • More sophisticated iteration control (e.g., running specific rows, conditional iterations).
    • Visual mapping of data file columns to request variables.
  • Backward Compatibility: This feature is fully backward compatible. Existing collection runs without iteration counts or data files will function as before.
  • Security Considerations: Data files are processed client-side. Users are responsible for the content of their uploaded files. No new external network requests are made as part of the data parsing.

Checklist

  • Linked issues (#5324, #5163)
  • Backward compatible
  • New UI elements for iteration count and data file upload
  • Collection Runner logic updated for iteration and data feed
  • CSV data parsing implemented
  • JSON data parsing implemented
  • Data variables injected into request context for each iteration
  • Manual tests performed
  • Automated tests (where applicable) added/updated

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5557 **Author:** [@Manohar-ford](https://github.com/Manohar-ford) **Created:** 11/4/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `update-2025.9.0` --- ### 📝 Commits (10+) - [`b630b1c`](https://github.com/hoppscotch/hoppscotch/commit/b630b1ca5fc0f0a9492eb8fddf64c6cb2b5162cf) feat: add support for iterations and validation in collection runner - [`86d4259`](https://github.com/hoppscotch/hoppscotch/commit/86d4259354b34fd1c52d239e765cdde5cbfe6651) feat: add dataset support for collection runner with CSV/JSON file upload - [`55d0a94`](https://github.com/hoppscotch/hoppscotch/commit/55d0a945c334b2cb4925e3c3c9c1aba2f5f8cc5b) Merge branch 'hoppscotch:main' into update-2025.9.0 - [`b35401a`](https://github.com/hoppscotch/hoppscotch/commit/b35401a55cac7da08e78a3faff8a3513786d14bf) Update packages/hoppscotch-common/locales/en.json - [`a9f6040`](https://github.com/hoppscotch/hoppscotch/commit/a9f604078973b5056927ab3cc687b75619364ed7) Update packages/hoppscotch-common/src/components/http/test/RunnerModal.vue - [`e189281`](https://github.com/hoppscotch/hoppscotch/commit/e18928172445760bed6ef3fdaab83bb5fe51d2ba) Update packages/hoppscotch-common/src/helpers/import-export/dataset/parser.ts - [`f1c92a9`](https://github.com/hoppscotch/hoppscotch/commit/f1c92a92a2aaf76928d2794b7fe587f4211bb024) Update packages/hoppscotch-common/src/components/http/test/RunnerModal.vue - [`d431e84`](https://github.com/hoppscotch/hoppscotch/commit/d431e8432cb1d18c4bb0bc4a118f5c18a74e7b1a) Update packages/hoppscotch-common/src/helpers/RequestRunner.ts - [`6331761`](https://github.com/hoppscotch/hoppscotch/commit/6331761b676cdc3e0444d7aabcf00aad2373a22e) Update packages/hoppscotch-common/src/components/http/test/RunnerModal.vue - [`394069d`](https://github.com/hoppscotch/hoppscotch/commit/394069d024a0b56e33d6c76cb7ddc6b9a6ec27d8) Merge branch 'main' into update-2025.9.0 ### 📊 Changes **6 files changed** (+616 additions, -66 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/locales/en.json` (+16 -0) 📝 `packages/hoppscotch-common/src/components/http/test/RunnerModal.vue` (+319 -6) 📝 `packages/hoppscotch-common/src/helpers/RequestRunner.ts` (+44 -10) ➕ `packages/hoppscotch-common/src/helpers/import-export/dataset/parser.ts` (+70 -0) 📝 `packages/hoppscotch-common/src/helpers/rest/document.ts` (+7 -0) 📝 `packages/hoppscotch-common/src/services/test-runner/test-runner.service.ts` (+160 -50) </details> ### 📄 Description <!-- Thanks for creating this pull request 🤗 Please make sure that the pull request is limited to one type (docs, feature, etc.) and keep it as small as possible. You can open multiple prs instead of opening a huge one. --> <img width="767" height="782" alt="Screenshot 2025-11-04 102316" src="https://github.com/user-attachments/assets/a88fe076-dfe4-40e8-b102-d75dac6b14d5" /> <img width="759" height="781" alt="Screenshot 2025-11-04 102339" src="https://github.com/user-attachments/assets/2511ecff-70e6-47cd-99a5-0a2462c91fb3" /> <img width="760" height="699" alt="Screenshot 2025-11-04 102358" src="https://github.com/user-attachments/assets/284e412e-62e2-4db3-8090-1f5672a1a1ef" /> <!-- If this pull request closes an issue, please mention the issue number below --> Closes #5324, Closes #5163 <!-- Add an introduction into what this PR tries to solve in a couple of sentences --> This Pull Request introduces significant enhancements to the Hoppscotch Collection Runner, enabling users to execute collections with simple iterations and drive request parameters using external data files. This allows for robust data-driven testing and automation of repetitive tasks, directly addressing user demands for more powerful collection execution capabilities. ### What's changed This PR implements two major features within the Collection Runner: **Simple Iteration** and **Data Feed (CSV/JSON)**. * **Collection Runner - Simple Iteration:** * A new input field has been added to the Collection Runner UI, allowing users to specify a fixed number of times a collection (or selected requests within it) should be executed. * The runner will now loop through the entire collection `N` times, providing a straightforward way to repeat tests or actions. * Each iteration will run with a fresh state, allowing for consistent testing across multiple runs. * **Collection Runner - Data Feed (CSV/JSON):** * Users can now upload external data files (CSV or JSON format) to drive variables within their requests during collection runs. * A new section in the Collection Runner UI allows for selecting and previewing the uploaded data file. * For each row in the data file (or each object in a JSON array), a new iteration of the collection is executed. * Data from the current row/object is automatically injected as environment variables for that specific iteration. For example, a CSV column `username` would be accessible as `{{username}}` in requests during that iteration. * This enables dynamic population of request URLs, headers, body, and query parameters, facilitating data-driven testing scenarios. * Robust parsing for both CSV and JSON formats is implemented, with clear feedback for malformed files. * **Integration and UI/UX:** * The Collection Runner interface has been updated to include controls for both iteration count and data file upload. * The execution logic of the Collection Runner has been refactored to manage the iteration loop and variable injection from data feeds. * Improved feedback mechanisms during the run to indicate current iteration number and data context. ### Notes to reviewers * **Motivation:** This feature directly responds to the community's need for advanced testing capabilities, as highlighted in issues #5324 and #5163. It allows Hoppscotch to compete more effectively with other API clients in terms of automated testing and data-driven workflows. * **Testing Strategy:** * **Manual Testing:** Extensive manual testing was performed to cover: * Running collections with a specified number of iterations (e.g., 1, 5, 10). * Uploading valid CSV and JSON files, ensuring correct variable injection into requests. * Testing with various request types (GET, POST, PUT) and variable locations (URL, headers, body). * Verifying error handling for malformed data files or missing variables. * Confirming that environments are correctly handled per iteration. * **Unit/Integration Tests:** Relevant unit and integration tests have been added/updated for the new iteration and data parsing logic. * **Edge Cases Considered:** * Empty data files: Handled gracefully, resulting in zero iterations or an appropriate error message. * Missing variables in data: Variables not found in the data file will fall back to existing environment/global variables or remain unresolved, consistent with current Hoppscotch behavior. * Large data files: Performance considerations were made for parsing, though extremely large files might still impact initial load time. * Data type handling: All data from CSV/JSON is treated as strings for variable substitution, allowing users to perform type conversions within their request scripts if needed. * **Future Enhancements (Out of Scope for this PR):** * Advanced reporting for data-driven runs (e.g., pass/fail statistics per iteration). * Support for additional data formats (e.g., Excel). * More sophisticated iteration control (e.g., running specific rows, conditional iterations). * Visual mapping of data file columns to request variables. * **Backward Compatibility:** This feature is fully backward compatible. Existing collection runs without iteration counts or data files will function as before. * **Security Considerations:** Data files are processed client-side. Users are responsible for the content of their uploaded files. No new external network requests are made as part of the data parsing. ### Checklist * [x] Linked issues (#5324, #5163) * [x] Backward compatible * [x] New UI elements for iteration count and data file upload * [x] Collection Runner logic updated for iteration and data feed * [x] CSV data parsing implemented * [x] JSON data parsing implemented * [x] Data variables injected into request context for each iteration * [x] Manual tests performed * [x] Automated tests (where applicable) added/updated --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5260
No description provided.