Prompt file imported from ArulaAI/copilot-engineering-test-optimization-lab-angular (
.github/prompts/generate-boundary-tests.prompt.md). Copyright stays with the author.
Generate Boundary Value Tests
Create thorough boundary tests using the 7-point analysis method.
Prerequisites
Reference the boundary gaps in #file:docs/TEST_ANALYSIS.md.
7-Point Boundary Analysis
For each boundary, test these 7 values:
- min - 1 (invalid, just below minimum)
- min (valid, at minimum)
- min + 1 (valid, just above minimum)
- typical (valid, normal value)
- max - 1 (valid, just below maximum)
- max (valid, at maximum)
- max + 1 (invalid, just above maximum)
Instructions
Document Boundaries as Constants
const BOUNDARIES = {
AMOUNT_MIN: 0.01,
AMOUNT_MAX: 999999.99,
QUANTITY_MIN: 1,
QUANTITY_MAX: 9999,
NAME_MIN_LENGTH: 1,
NAME_MAX_LENGTH: 100,
} as const;
Testing Pattern
describe('amount validation', () => {
test.each([
[0, false, 'below minimum'],
[0.01, true, 'at minimum'],
[0.02, true, 'just above minimum'],
[500, true, 'typical value'],
[999999.98, true, 'just below maximum'],
[999999.99, true, 'at maximum'],
[1000000, false, 'above maximum'],
])('amount %s is valid=%s (%s)', (amount, expected, reason) => {
expect(validator.isValidAmount(amount)).toBe(expected);
});
});
// Include null/undefined/NaN handling
describe('handles edge cases', () => {
test.each([
[null, false, 'null'],
[undefined, false, 'undefined'],
[NaN, false, 'NaN'],
[Infinity, false, 'Infinity'],
[-Infinity, false, '-Infinity'],
['100', false, 'string number'],
])('rejects %s (%s)', (value, expected, reason) => {
expect(validator.isValidAmount(value as any)).toBe(expected);
});
});
Reference: .golden-examples/boundary-testing/
Boundary Categories
- Numeric Values: amounts, quantities, percentages, ages
- String Lengths: names, descriptions, codes, identifiers
- Collection Sizes: list items, array elements, batch sizes
- Date/Time: past dates, future dates, time ranges
- Special Values: null, empty, whitespace, zero
Output
Generate tests that document boundaries as constants and test all 7 points for each boundary identified.