This prompt is for QA engineers and SDETs who need to translate numeric, date, string-length, and collection-size constraints from requirements into precise, testable Gherkin scenarios. The job-to-be-done is systematic boundary value analysis (BVA): identifying on-point, off-point, and extreme-value partitions for every constrained input field and producing executable scenarios with explicit expected outcomes. You should use this prompt when you have a requirement that specifies a range, limit, or size constraint—such as 'password must be 8–64 characters,' 'discount applies to orders over $100,' or 'report generation must complete within 30 seconds'—and you need to ensure your test suite covers the boundaries, not just the happy path. The ideal user has access to the source requirement text and understands the system's input validation rules, but may not have exhaustively mapped every boundary partition.
Prompt
Boundary Value Analysis Prompt for Behavior Specs

When to Use This Prompt
Define the job, reader, and constraints for boundary value analysis in behavior specification.
Do not use this prompt when the requirement lacks any quantifiable constraint, when you need performance test scenarios rather than functional boundary tests, or when the system under test has undocumented validation behavior that requires exploratory investigation first. This prompt assumes the constraints are explicitly stated or can be reasonably inferred from the specification. It is not a replacement for state-transition testing, authorization matrix coverage, or concurrency test design—those require separate, specialized prompts. If the requirement involves complex cross-field validation rules (e.g., 'end date must be after start date'), pair this prompt with the Data Validation Rule to Gherkin prompt to ensure relational constraints are covered alongside field-level boundaries.
Before running this prompt, gather the requirement text, any referenced schema definitions, and the expected error-handling behavior for out-of-bounds inputs. The prompt works best when you provide the constraint type (numeric, date, string-length, or collection-size) explicitly, as this guides the partition logic. After generating the scenarios, validate that every boundary has both an on-point value (the exact boundary) and an off-point value (just outside the boundary), and that extreme values like zero, empty, maximum, and overflow are represented. If the system's error messages or HTTP status codes are known, include them in the expected outcomes to make the scenarios automation-ready. For high-risk domains like payments or healthcare, always route the generated scenarios through a peer review step before committing them to your test management system.
Use Case Fit
Where this prompt works reliably and where it should not be used.
Strong Fit: Structured Constraint Extraction
Use when: Requirements explicitly define numeric ranges, string lengths, date windows, or collection sizes. The prompt reliably partitions these into on-point, off-point, and extreme-value scenarios. Guardrail: Provide the constraint values directly in the [CONSTRAINTS] input block rather than asking the model to infer them from prose.
Strong Fit: Gherkin Automation Handoff
Use when: The output must feed directly into BDD frameworks like Cucumber or SpecFlow. The prompt produces executable Given-When-Then scenarios with explicit expected outcomes. Guardrail: Include an [OUTPUT_SCHEMA] that enforces Gherkin keyword structure and examples tables so downstream parsers don't break.
Poor Fit: Implicit or Vague Constraints
Avoid when: Requirements use qualitative terms like 'fast,' 'large,' or 'reasonable' without concrete thresholds. The model will invent arbitrary boundaries that don't reflect real system limits. Guardrail: Run the Ambiguous Requirement Clarification Prompt first to surface missing constraints before attempting boundary analysis.
Poor Fit: Non-Deterministic System Behavior
Avoid when: The system under test involves race conditions, eventual consistency, or timing-dependent outcomes. Boundary value analysis assumes deterministic input-output relationships. Guardrail: Pair this prompt with the Race Condition Scenario Generation Prompt for concurrency coverage, and flag any boundary scenario that depends on execution order.
Required Input: Explicit Constraint Definitions
Risk: Without clear constraint types, the model may confuse string-length boundaries with numeric range boundaries or miss partition classes entirely. Guardrail: Structure inputs as typed constraints: {field: 'age', type: 'integer', min: 0, max: 120} rather than free-text descriptions. Validate that every constraint has both lower and upper bounds where applicable.
Operational Risk: Missing Partition Classes
Risk: The model may skip off-point values just outside boundaries or fail to generate extreme values at the edges of valid ranges. This creates false confidence in boundary coverage. Guardrail: Add a post-generation validation step that checks for three-point boundary coverage per constraint: one value at the boundary, one just inside, and one just outside. Flag any constraint with fewer than three scenarios.
Copy-Ready Prompt Template
A reusable prompt template for generating boundary value analysis Gherkin scenarios from numeric, date, string-length, and collection-size constraints.
This prompt template is the core of the Boundary Value Analysis playbook. It is designed to take a structured description of a system constraint—such as a field length, a numeric range, or a date window—and produce a set of Gherkin scenarios that test the boundaries of that constraint. The template uses square-bracket placeholders for all variable inputs, making it straightforward to copy, adapt, and integrate into a test generation pipeline. The output is structured to be directly usable by BDD frameworks like Cucumber or SpecFlow.
markdownYou are a QA engineer specializing in boundary value analysis for behavior-driven development. Your task is to analyze the provided constraint and generate a set of Gherkin scenarios that test its boundaries. You must produce scenarios for on-point (valid boundary), off-point (just outside the boundary), and extreme values. **Constraint to Analyze:** [CONSTRAINT_DESCRIPTION] **Output Schema:** Generate a Gherkin feature file section with the following structure: - A `Feature` title summarizing the boundary test. - A `Scenario Outline` for each boundary condition (minimum, maximum, and any other relevant partition). - Each `Scenario Outline` must include an `Examples` table with columns for the test input and the expected result. - Use tags like `@boundary`, `@on-point`, `@off-point`, and `@extreme` to categorize each scenario. **Constraints for Generation:** - [OUTPUT_SCHEMA]: The output must be valid Gherkin syntax. - [CONSTRAINTS]: Do not invent constraints. Only test the boundaries explicitly described in [CONSTRAINT_DESCRIPTION]. If the constraint is a numeric range of 1-100, test values like 0, 1, 100, 101, and a mid-range value. For string lengths, test empty strings, max length, max length + 1, and a string with special characters. - [RISK_LEVEL]: Medium. The output will be used to guide automated test creation, so precision is critical. If the constraint description is ambiguous, state the assumption you are making before generating the scenarios. **Example Input:** [CONSTRAINT_DESCRIPTION]: "The 'age' field must be an integer between 18 and 65, inclusive." **Example Output:** ```gherkin Feature: Age Field Boundary Validation As a user, I should be prevented from entering an age outside the 18-65 range. @boundary @off-point Scenario Outline: Age is below the minimum valid value Given I enter an age of "<age>" When I submit the form Then I should see an error message "Age must be between 18 and 65" Examples: | age | | 17 | | 0 | | -1 | @boundary @on-point Scenario Outline: Age is at the minimum valid value Given I enter an age of "<age>" When I submit the form Then the submission should be successful Examples: | age | | 18 | # ... other scenarios for maximum, on-point, and extreme values
Now, generate the boundary value analysis Gherkin scenarios for the provided constraint.
To adapt this template, replace the [CONSTRAINT_DESCRIPTION] placeholder with a clear, single-sentence description of the rule you are testing. The [OUTPUT_SCHEMA] and [CONSTRAINTS] placeholders can be customized to enforce specific formats or to add domain-specific rules, such as requiring specific error codes or log messages in the Then steps. For high-risk financial or healthcare applications, always add a human review step after generation to verify that no boundary conditions were missed and that the expected outcomes align with the precise regulatory specification.
Prompt Variables
Required inputs for the Boundary Value Analysis prompt. Each placeholder must be populated before execution to ensure the model correctly identifies on-point, off-point, and extreme-value partitions.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[REQUIREMENT_TEXT] | The raw requirement containing the numeric, date, string-length, or collection-size constraint to analyze | The password must be between 8 and 64 characters and the user must be between 13 and 120 years old. | Must contain at least one explicit boundary constraint. Reject if text has no quantifiable limits. |
[CONSTRAINT_TYPE] | Explicitly declares the domain of the boundary to prevent the model from guessing the wrong partition type | numeric-range | Must be one of: numeric-range, date-range, string-length, collection-size, time-duration. Schema check required. |
[SYSTEM_UNDER_TEST] | Names the specific function, API endpoint, or UI field the boundary applies to, anchoring the generated scenarios | POST /v1/users password field | Must be a concrete identifier. Reject generic values like 'the system' or 'the field'. |
[PRECONDITIONS] | Describes the state required before the boundary test executes, ensuring the scenario setup is valid | User is on the registration page; all other fields contain valid data. | Must be a list of true pre-states. Null allowed if no preconditions exist, but explicitly declare as empty string. |
[OUTPUT_FORMAT] | Specifies the exact structure for the generated scenarios to ensure downstream automation compatibility | Gherkin Scenario Outline with Examples table | Must be one of: Gherkin Scenario Outline, JSON test case array, or tabular partition list. Reject ambiguous formats. |
[PARTITION_TYPES] | Controls which boundary partitions the prompt must generate to prevent missing off-point or extreme-value cases | on-point, off-point, extreme-min, extreme-max | Must be a comma-separated subset. Reject if 'on-point' is missing. Warn if 'off-point' is missing for numeric or date constraints. |
[ADDITIONAL_CONTEXT] | Supplies domain rules, validation messages, or business logic that modifies expected outcomes at boundaries | Passwords exactly 8 chars are valid; ages exactly 13 are valid; negative ages are rejected with error code INVALID_AGE. | Null allowed. If provided, must be a string. Check that context does not contradict [REQUIREMENT_TEXT]. |
Implementation Harness Notes
How to wire the Boundary Value Analysis prompt into a test management system or CI pipeline with validation, retries, and human review gates.
The Boundary Value Analysis prompt is designed to be called programmatically as part of a test generation pipeline, not as a one-off chat interaction. The typical integration point is a QA microservice or a CI job that receives a structured requirement object (containing fields, constraints, and data types) and returns a set of Gherkin scenarios. You should wrap the prompt in an application harness that validates the output schema before the scenarios ever reach your test management system. The harness is responsible for providing the [INPUT_SCHEMA] and [CONSTRAINTS] placeholders from a machine-readable source such as a JSON Schema definition, an OpenAPI spec fragment, or a structured requirement ticket. Do not rely on free-text requirements alone; the prompt performs best when it receives explicit type information (e.g., type: integer, minimum: 0, maximum: 100, exclusiveMaximum: true) rather than prose descriptions of limits.
The implementation harness must enforce a strict output contract. After the model responds, validate that every returned scenario conforms to the expected Gherkin structure and that each boundary partition (on-point, off-point, extreme-value) is present for every numeric, date, string-length, or collection-size constraint in the input. A recommended approach is to define a JSON output schema in the prompt itself using the [OUTPUT_SCHEMA] placeholder, then validate the parsed response with a library like ajv (JavaScript) or pydantic (Python). If validation fails, implement a single retry by feeding the validation error message back into the prompt via a [CORRECTION_FEEDBACK] placeholder. After one retry, if the output still fails schema validation, route the result to a human review queue rather than silently dropping malformed scenarios. Log every generation attempt—including the input constraints, the raw model output, and the validation result—so that prompt drift and model behavior changes are traceable over time.
For CI pipeline integration, treat the prompt as a test asset under version control. Store the prompt template alongside your test generation code, and use a model that supports structured outputs (such as GPT-4o with response_format or Claude with tool-use mode) to reduce parsing fragility. When wiring into a test management system like TestRail, Xray, or Zephyr, map the generated Gherkin scenarios to the system's API: each scenario becomes a test case with the boundary type (on-point, off-point, extreme) stored as a tag or custom field for coverage reporting. Add an eval step that compares the generated boundary partitions against a known-good set of expected partitions for a small golden dataset; if the model misses a partition class (e.g., no extreme-value scenario for a date field), fail the CI job. This ensures that prompt changes don't silently degrade boundary coverage. Finally, never auto-commit generated scenarios to the test repository without human approval when the input constraints come from a regulated domain (safety-critical, financial, or healthcare systems). The harness should flag these for review and attach the full generation trace to the review request.
Expected Output Contract
Defines the structure, types, and validation rules for the Gherkin scenarios generated by the Boundary Value Analysis prompt. Use this contract to build a post-processing validator before the output enters your test management system.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
Scenario Outline Title | String starting with 'Scenario Outline:' | Must contain the boundary variable name in angle brackets, e.g., '<age>'. Parse check: title must not be empty. | |
Examples Table | Markdown table with header row and data rows | Must contain exactly one column per boundary variable. Schema check: column count must match variable count in scenario steps. | |
Boundary Partition Tag | String matching '@on-point', '@off-point', or '@extreme' | Every example row must have a corresponding partition tag. Enum check: reject rows with missing or unrecognized tags. | |
Expected Outcome Column | String column named 'Expected Outcome' | Must be present in the Examples table. Null check: no cell in this column may be empty or 'TBD'. | |
Given Step Precondition | String starting with 'Given ' | Must reference a specific system state. Parse check: reject if the step describes an action rather than a state. | |
When Step Action | String starting with 'When ' | Must contain the boundary variable in angle brackets. Parse check: reject if no angle-bracket variable is present. | |
Then Step Assertion | String starting with 'Then ' | Must reference a concrete, verifiable outcome. Confidence check: reject if the assertion contains hedging language like 'should probably' or 'might'. | |
Boundary Type Indicator | String: 'numeric', 'date', 'string-length', or 'collection-size' | Must be declared once per scenario. Enum check: reject if the boundary type does not match the variable's validation rule in the source requirement. |
Common Failure Modes
Boundary value analysis prompts are precise but brittle. These are the most common failure modes when generating Gherkin scenarios from numeric, date, string-length, and collection-size constraints, and how to prevent them in production.
Missing Partition Classes
What to watch: The prompt generates on-point and off-point values but skips entire equivalence partitions, such as negative numbers, empty strings, or null inputs. This happens when the requirement text implies but doesn't state the partition explicitly. Guardrail: Add a [PARTITION_CHECKLIST] variable listing required partitions (valid, invalid-low, invalid-high, null, empty, max+1) and instruct the model to mark any missing partition as UNCOVERED rather than silently omitting it.
Boundary Type Confusion
What to watch: The model treats a date boundary as a string comparison or a numeric boundary as an integer when the spec requires decimal precision. This produces scenarios that pass validation but test the wrong data type. Guardrail: Include an explicit [BOUNDARY_TYPE] field in the output schema (e.g., numeric_integer, numeric_decimal, date_iso8601, string_utf8) and validate that generated boundary values conform to that type before accepting the output.
Off-By-One Errors in Extreme Values
What to watch: The model generates max+1 as max or min-1 as min, especially when the constraint is expressed as a range like "1 to 100 characters." The scenario looks correct but doesn't actually test the boundary. Guardrail: Add a post-generation validation step that parses each boundary value, compares it against the constraint, and flags any value that falls inside the valid range when it should be outside, or vice versa.
Collection Boundary Blindness
What to watch: The prompt handles scalar boundaries well but fails on collection-size constraints, such as "up to 5 attachments" or "at least 2 approvers." Empty collections, single-element edge cases, and max-size+1 scenarios are frequently omitted. Guardrail: Add a dedicated [COLLECTION_CONSTRAINTS] section to the input template with fields for min_size, max_size, and element_type, and require the model to generate scenarios for size=0, size=1, size=min, size=max, and size=max+1.
Expected Outcome Ambiguity
What to watch: The model generates boundary values correctly but writes vague expected outcomes like "system should handle it" or "error should occur" without specifying the exact error code, message, or behavior. This makes the scenario non-executable. Guardrail: Require an [EXPECTED_OUTCOME_SCHEMA] with fields for status_code, error_type, user_message_pattern, and system_behavior, and reject any scenario where these fields are empty or contain placeholder language.
Constraint Interaction Collapse
What to watch: When multiple constraints interact—such as a date range combined with a string-length limit—the model tests each constraint in isolation but never tests them at their combined boundaries. This leaves gaps where real bugs hide. Guardrail: Add a [CONSTRAINT_INTERACTION] instruction that requires at least one scenario per pair of interacting constraints, testing the boundary of one while the other is also at its boundary, and flag any output that lacks cross-constraint scenarios.
Evaluation Rubric
Use this rubric to evaluate the quality of boundary value analysis outputs before integrating the prompt into your QA pipeline. Each criterion targets a specific failure mode common in boundary test generation.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Boundary Type Coverage | Output includes on-point, off-point, and extreme-value scenarios for every numeric, date, string-length, and collection-size constraint in [REQUIREMENT_INPUT] | Missing boundary type for a documented constraint; only happy-path values present | Schema check: count distinct boundary types per constraint field; flag any constraint with fewer than 3 boundary types |
Partition Completeness | Every equivalence partition implied by the constraints has at least one representative scenario | A valid partition (e.g., empty string, negative number, max-length-plus-one) has zero test cases | Partition enumeration: extract all partitions from [REQUIREMENT_INPUT] constraints, cross-reference against generated scenario inputs, flag missing partitions |
Expected Outcome Specificity | Each scenario includes an explicit, verifiable expected outcome (error code, message, or state change), not generic 'should fail' or 'should work' | Expected outcome column contains vague phrases like 'error thrown', 'works correctly', or 'handled' | String match against vague-outcome pattern list; require specific error codes, status values, or state assertions per scenario |
Gherkin Syntax Validity | All scenarios parse as valid Gherkin with correct Given-When-Then structure, no missing keywords, and valid examples table formatting | Gherkin parser throws errors on any scenario; malformed tables or missing When/Then steps | Automated Gherkin linter parse check on full output; reject if any scenario fails to parse |
Constraint Traceability | Each generated scenario references the specific constraint or rule from [REQUIREMENT_INPUT] that it exercises | Scenarios present without any source constraint mapping; untraceable test cases | Trace tag check: verify every scenario has a constraint-reference tag or comment; flag untagged scenarios for manual review |
Off-Point Value Precision | Off-point values are exactly one unit beyond the boundary (e.g., max+1, min-1, length+1 char) for each constraint | Off-point values are arbitrary large/small numbers or multiple units away from the boundary | Boundary distance calculation: for each off-point scenario, compute distance from declared boundary; flag any distance greater than 1 unit |
Data Type Consistency | Test input values match the declared data type of each constraint field (integer, decimal, ISO date, string) | String value provided for numeric field; date in wrong format; type mismatch between constraint and test data | Schema validation: compare each scenario input value type against [REQUIREMENT_INPUT] field type declarations; flag mismatches |
Null and Absence Handling | Scenarios cover null input, missing field, and empty collection cases for every optional or nullable constraint | No null-handling scenarios present despite optional fields in [REQUIREMENT_INPUT]; null treated same as empty | Null-coverage scan: identify all optional or nullable fields in constraints, verify at least one null/absent scenario per field exists |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single boundary constraint and a lightweight output format. Replace the full Gherkin schema with a simpler markdown checklist. Drop the schema validation step and accept free-text boundary descriptions.
codeAnalyze [REQUIREMENT_TEXT] and list boundary values for [CONSTRAINT_TYPE]. For each boundary, provide: value, classification (on-point/off-point/extreme), and expected outcome. Return as a markdown table.
Watch for
- Missing boundary classifications when the model skips the on-point/off-point distinction
- Overly narrow boundary selection that ignores extreme values
- No partition coverage—only testing the boundary itself without the adjacent partitions

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us