-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Introduce iterations & data feed (CSV/JSON) to address #5324, #5163 #5557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds data-driven testing capabilities to the test runner, allowing users to run collection tests with iterations using CSV or JSON dataset files. The key changes include implementing dataset parsing, iteration management, and UI components for dataset upload and configuration.
- Added dataset file upload support (CSV/JSON) with validation and preview capabilities
- Implemented iteration logic that cycles through dataset rows and runs tests multiple times
- Enhanced test runner to accumulate results across iterations instead of overwriting them
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| test-runner.service.ts | Refactored test execution to support iterations with dataset injection, modified collection/request handling to append results instead of replacing them |
| document.ts | Added dataset configuration type to TestRunnerConfig for storing dataset metadata and content |
| parser.ts | New utility file for parsing and validating CSV/JSON dataset files |
| RequestRunner.ts | Enhanced request runner to inject iteration data as environment variables during test execution |
| RunnerModal.vue | Added UI for dataset file upload, preview, download, and iteration configuration with visual feedback |
| en.json | Added localization strings for dataset-related UI text and error messages |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| for (let i = 1; i < lines.length; i++) { | ||
| const obj: Record<string, string> = {} | ||
| const currentLine = lines[i].split(",") |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CSV parser uses a naive comma split that will break when values contain commas (e.g., quoted strings like 'Hello, World'). This fails to handle standard CSV features like quoted fields, escaped quotes, or commas within values. Consider using a proper CSV parsing library or implementing RFC 4180 compliant parsing.
| t("collection_runner.dataset_iterations_info", { | ||
| iterations: config.iterations, | ||
| rows: datasetRowCount, | ||
| total: config.iterations * datasetRowCount, |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calculation for total iterations is incorrect. When dataset is enabled, the total should be just config.iterations (each iteration uses one row), not config.iterations * datasetRowCount. This misleads users about the actual number of test runs.
packages/hoppscotch-common/src/components/http/test/RunnerModal.vue
Outdated
Show resolved
Hide resolved
packages/hoppscotch-common/src/components/http/test/RunnerModal.vue
Outdated
Show resolved
Hide resolved
packages/hoppscotch-common/src/helpers/import-export/dataset/parser.ts
Outdated
Show resolved
Hide resolved
packages/hoppscotch-common/src/components/http/test/RunnerModal.vue
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…l.vue Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…arser.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…l.vue Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…l.vue Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 6 files
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/hoppscotch-common/src/helpers/import-export/dataset/parser.ts">
<violation number="1" location="packages/hoppscotch-common/src/helpers/import-export/dataset/parser.ts:48">
Convert JSON dataset values to strings so CSV/JSON feeds behave consistently during variable injection.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 6 files
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/hoppscotch-common/src/helpers/import-export/dataset/parser.ts">
<violation number="1" location="packages/hoppscotch-common/src/helpers/import-export/dataset/parser.ts:43">
P2: The function wraps any non-array value without checking if it's actually an object. If the JSON contains a primitive (e.g., `"string"`, `123`, `null`) or an array of primitives, the return type `Array<Record<string, any>>` is violated. Consider validating the parsed value is an object before wrapping, and validating array items.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
…arser.ts Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/hoppscotch-common/src/helpers/import-export/dataset/parser.ts">
<violation number="1" location="packages/hoppscotch-common/src/helpers/import-export/dataset/parser.ts:51">
P2: The validation allows arrays to pass as valid items since `typeof [] === "object"` in JavaScript. Input like `[[1,2], [3,4]]` would incorrectly pass validation. Add `&& !Array.isArray(item)` to ensure only plain objects are accepted.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
packages/hoppscotch-common/src/helpers/import-export/dataset/parser.ts
Outdated
Show resolved
Hide resolved
…arser.ts Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
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:
Ntimes, providing a straightforward way to repeat tests or actions.Collection Runner - Data Feed (CSV/JSON):
usernamewould be accessible as{{username}}in requests during that iteration.Integration and UI/UX:
Notes to reviewers
Checklist